File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2635,7 +2635,10 @@ pub trait Iterator {
2635
2635
} ;
2636
2636
2637
2637
while let Some ( curr) = self . next ( ) {
2638
- if compare ( & last, & curr) . map ( |o| o == Ordering :: Greater ) . unwrap_or ( true ) {
2638
+ if compare ( & last, & curr)
2639
+ . map ( |o| o == Ordering :: Greater )
2640
+ . unwrap_or ( true )
2641
+ {
2639
2642
return false ;
2640
2643
}
2641
2644
last = curr;
Original file line number Diff line number Diff line change @@ -2301,13 +2301,11 @@ impl<T> [T] {
2301
2301
where
2302
2302
F : FnMut ( & T , & T ) -> Option < Ordering >
2303
2303
{
2304
- let len = self . len ( ) ;
2305
- if len <= 1 {
2306
- return true ;
2307
- }
2308
-
2309
- for i in 1 ..len {
2310
- if compare ( & self [ i - 1 ] , & self [ i] ) . map ( |o| o == Ordering :: Greater ) . unwrap_or ( true ) {
2304
+ for pair in self . windows ( 2 ) {
2305
+ if compare ( & pair[ 0 ] , & pair[ 1 ] )
2306
+ . map ( |o| o == Ordering :: Greater )
2307
+ . unwrap_or ( true )
2308
+ {
2311
2309
return false ;
2312
2310
}
2313
2311
}
You can’t perform that action at this time.
0 commit comments