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 @@ -2635,7 +2635,10 @@ pub trait Iterator {
26352635 } ;
26362636
26372637 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+ {
26392642 return false ;
26402643 }
26412644 last = curr;
Original file line number Diff line number Diff line change @@ -2301,13 +2301,11 @@ impl<T> [T] {
23012301 where
23022302 F : FnMut ( & T , & T ) -> Option < Ordering >
23032303 {
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+ {
23112309 return false ;
23122310 }
23132311 }
You can’t perform that action at this time.
0 commit comments