File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2655,7 +2655,10 @@ pub trait Iterator {
26552655 } ;
26562656
26572657 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+ {
26592662 return false ;
26602663 }
26612664 last = curr;
Original file line number Diff line number Diff line change @@ -2293,13 +2293,11 @@ impl<T> [T] {
22932293 where
22942294 F : FnMut ( & T , & T ) -> Option < Ordering >
22952295 {
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+ {
23032301 return false ;
23042302 }
23052303 }
You can’t perform that action at this time.
0 commit comments