diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-07-13 09:34:34 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-07-28 03:16:55 +0000 |
| commit | a5d0c2c17482e56cae5112083207e8c0ce19cb96 (patch) | |
| tree | d60149bf066026a72c73e30400a31a47d0f3b8d5 /library/std/src | |
| parent | ac48e62db85e6db4bbe026490381ab205f4a614d (diff) | |
| download | rust-a5d0c2c17482e56cae5112083207e8c0ce19cb96.tar.gz rust-a5d0c2c17482e56cae5112083207e8c0ce19cb96.zip | |
Remove redundant len binding
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/windows/mod.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index 9a52371280e..3d155a8c8f0 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -99,11 +99,10 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> { let ptr = haystack.as_ptr(); - let mut len = haystack.len(); let mut start = &haystack[..]; // For performance reasons unfold the loop eight times. - while len >= 8 { + while start.len() >= 8 { if start[0] == needle { return Some((start.as_ptr() as usize - ptr as usize) / 2); } @@ -130,7 +129,6 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> { } start = &start[8..]; - len -= 8; } for (i, c) in start.iter().enumerate() { |
