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,
|
||||
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
|
||||
{
|
||||
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))
|
||||
}
|
||||
}}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue