@@ -264,8 +264,7 @@ impl<K, V> Slice<K, V> {
264264 where
265265 K : PartialOrd ,
266266 {
267- // TODO(MSRV 1.82): self.entries.is_sorted_by(|a, b| a.key <= b.key)
268- self . is_sorted_by_key ( |k, _| k)
267+ self . entries . is_sorted_by ( |a, b| a. key <= b. key )
269268 }
270269
271270 /// Checks if this slice is sorted using the given comparator function.
@@ -274,17 +273,8 @@ impl<K, V> Slice<K, V> {
274273 where
275274 F : FnMut ( & ' a K , & ' a V , & ' a K , & ' a V ) -> bool ,
276275 {
277- // TODO(MSRV 1.82): self.entries
278- // .is_sorted_by(move |a, b| cmp(&a.key, &a.value, &b.key, &b.value))
279- let mut iter = self . entries . iter ( ) ;
280- match iter. next ( ) {
281- Some ( mut prev) => iter. all ( move |next| {
282- let sorted = cmp ( & prev. key , & prev. value , & next. key , & next. value ) ;
283- prev = next;
284- sorted
285- } ) ,
286- None => true ,
287- }
276+ self . entries
277+ . is_sorted_by ( move |a, b| cmp ( & a. key , & a. value , & b. key , & b. value ) )
288278 }
289279
290280 /// Checks if this slice is sorted using the given sort-key function.
@@ -294,17 +284,8 @@ impl<K, V> Slice<K, V> {
294284 F : FnMut ( & ' a K , & ' a V ) -> T ,
295285 T : PartialOrd ,
296286 {
297- // TODO(MSRV 1.82): self.entries
298- // .is_sorted_by_key(move |a| sort_key(&a.key, &a.value))
299- let mut iter = self . entries . iter ( ) . map ( move |a| sort_key ( & a. key , & a. value ) ) ;
300- match iter. next ( ) {
301- Some ( mut prev) => iter. all ( move |next| {
302- let sorted = prev <= next;
303- prev = next;
304- sorted
305- } ) ,
306- None => true ,
307- }
287+ self . entries
288+ . is_sorted_by_key ( move |a| sort_key ( & a. key , & a. value ) )
308289 }
309290
310291 /// Returns the index of the partition point of a sorted map according to the given predicate
0 commit comments