diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index c4317799bcc..68c7c5f23c9 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -132,9 +132,7 @@ iterator! {struct Iter -> *const T, &'a T, const, {/* no mut */}, { Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Option, { - self.as_slice().windows(2).all(|w| { - compare(&&w[0], &&w[1]).map(|o| o != Ordering::Greater).unwrap_or(false) - }) + self.as_slice().array_windows().all(|[a, b]| compare(&a, &b).map_or(false, Ordering::is_le)) } }}