From a6e0aa20d90ee9173a6b901c641a8d48abbd82db Mon Sep 17 00:00:00 2001 From: The8472 Date: Mon, 8 Nov 2021 19:29:16 +0100 Subject: [PATCH 1/1] remove redundant .iter() call since zip() takes an IntoIterator argument --- library/std/src/path.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 33225692d17..7e1135365cd 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -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)) -- 2.44.0