Make slice::is_sorted_by
impl nicer
This commit is contained in:
parent
e4b9f86054
commit
0d53565b60
1 changed files with 1 additions and 3 deletions
|
@ -132,9 +132,7 @@ iterator! {struct Iter -> *const T, &'a T, const, {/* no mut */}, {
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
|
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
|
||||||
{
|
{
|
||||||
self.as_slice().windows(2).all(|w| {
|
self.as_slice().array_windows().all(|[a, b]| compare(&a, &b).map_or(false, Ordering::is_le))
|
||||||
compare(&&w[0], &&w[1]).map(|o| o != Ordering::Greater).unwrap_or(false)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue