Skip to content

Commit 5cd0504

Browse files
committed
Convert sort_unstable_by to sort_by_cached_key
1 parent d3fe534 commit 5cd0504

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/librustdoc/clean/auto_trait.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,9 +1435,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
14351435
// involved (impls rarely have more than a few bounds) means that it
14361436
// shouldn't matter in practice.
14371437
fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
1438-
vec.sort_unstable_by(|first, second| {
1439-
format!("{:?}", first).cmp(&format!("{:?}", second))
1440-
});
1438+
vec.sort_by_cached_key(|x| format!("{:?}", x))
14411439
}
14421440

14431441
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {

src/librustdoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(box_syntax)]
2121
#![feature(fs_read_write)]
2222
#![feature(set_stdio)]
23+
#![feature(slice_sort_by_cached_key)]
2324
#![feature(test)]
2425
#![feature(unicode)]
2526
#![feature(vec_remove_item)]

0 commit comments

Comments
 (0)