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 @@ -2655,7 +2655,10 @@ pub trait Iterator {
2655
2655
} ;
2656
2656
2657
2657
while let Some ( curr) = self . next ( ) {
2658
- if compare ( & last, & curr) . map ( |o| o == Ordering :: Greater ) . unwrap_or ( true ) {
2658
+ if compare ( & last, & curr)
2659
+ . map ( |o| o == Ordering :: Greater )
2660
+ . unwrap_or ( true )
2661
+ {
2659
2662
return false ;
2660
2663
}
2661
2664
last = curr;
Original file line number Diff line number Diff line change @@ -2293,13 +2293,11 @@ impl<T> [T] {
2293
2293
where
2294
2294
F : FnMut ( & T , & T ) -> Option < Ordering >
2295
2295
{
2296
- let len = self . len ( ) ;
2297
- if len <= 1 {
2298
- return true ;
2299
- }
2300
-
2301
- for i in 1 ..len {
2302
- if compare ( & self [ i - 1 ] , & self [ i] ) . map ( |o| o == Ordering :: Greater ) . unwrap_or ( true ) {
2296
+ for pair in self . windows ( 2 ) {
2297
+ if compare ( & pair[ 0 ] , & pair[ 1 ] )
2298
+ . map ( |o| o == Ordering :: Greater )
2299
+ . unwrap_or ( true )
2300
+ {
2303
2301
return false ;
2304
2302
}
2305
2303
}
You can’t perform that action at this time.
0 commit comments