mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
Remove redundant len binding
This commit is contained in:
parent
ac48e62db8
commit
a5d0c2c174
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user