Skip to content

Commit

Permalink
Remove redundant len binding
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jul 28, 2020
1 parent ac48e62 commit a5d0c2c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions library/std/src/sys/windows/mod.rs
Expand Up @@ -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);
}
Expand All @@ -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() {
Expand Down

0 comments on commit a5d0c2c

Please sign in to comment.