Skip to content

Commit

Permalink
remove redundant .iter() call since zip() takes an IntoIterator argument
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Nov 9, 2021
1 parent 7f6e080 commit a6e0aa2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,11 @@ fn compare_components(mut left: Components<'_>, mut right: Components<'_>) -> cm
// the middle of one
if left.prefix.is_none() && right.prefix.is_none() && left.front == right.front {
// possible future improvement: a [u8]::first_mismatch simd implementation
let first_difference =
match left.path.iter().zip(right.path.iter()).position(|(&a, &b)| a != b) {
None if left.path.len() == right.path.len() => return cmp::Ordering::Equal,
None => left.path.len().min(right.path.len()),
Some(diff) => diff,
};
let first_difference = match left.path.iter().zip(right.path).position(|(&a, &b)| a != b) {
None if left.path.len() == right.path.len() => return cmp::Ordering::Equal,
None => left.path.len().min(right.path.len()),
Some(diff) => diff,
};

if let Some(previous_sep) =
left.path[..first_difference].iter().rposition(|&b| left.is_sep_byte(b))
Expand Down

0 comments on commit a6e0aa2

Please sign in to comment.