File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -2572,13 +2572,13 @@ pub trait Iterator {
2572
2572
/// ```
2573
2573
#[ inline]
2574
2574
#[ unstable( feature = "is_sorted" , reason = "new API" , issue = "53485" ) ]
2575
- fn is_sorted_by_key < F , K > ( self , mut f : F ) -> bool
2575
+ fn is_sorted_by_key < F , K > ( self , f : F ) -> bool
2576
2576
where
2577
2577
Self : Sized ,
2578
- F : FnMut ( & Self :: Item ) -> K ,
2578
+ F : FnMut ( Self :: Item ) -> K ,
2579
2579
K : PartialOrd
2580
2580
{
2581
- self . is_sorted_by ( |a , b| f ( a ) . partial_cmp ( & f ( b ) ) )
2581
+ self . map ( f ) . is_sorted ( )
2582
2582
}
2583
2583
}
2584
2584
Original file line number Diff line number Diff line change @@ -2459,12 +2459,12 @@ impl<T> [T] {
2459
2459
/// ```
2460
2460
#[ inline]
2461
2461
#[ unstable( feature = "is_sorted" , reason = "new API" , issue = "53485" ) ]
2462
- pub fn is_sorted_by_key < F , K > ( & self , mut f : F ) -> bool
2462
+ pub fn is_sorted_by_key < F , K > ( & self , f : F ) -> bool
2463
2463
where
2464
2464
F : FnMut ( & T ) -> K ,
2465
2465
K : PartialOrd
2466
2466
{
2467
- self . is_sorted_by ( |a , b| f ( a ) . partial_cmp ( & f ( b ) ) )
2467
+ self . iter ( ) . is_sorted_by_key ( f )
2468
2468
}
2469
2469
}
2470
2470
You can’t perform that action at this time.
0 commit comments