Convert sort_unstable_by to sort_by_cached_key

This commit is contained in:
varkor 2018-03-30 10:44:12 +01:00
parent d3fe534fcf
commit 5cd0504d10
2 changed files with 2 additions and 3 deletions

View File

@ -1435,9 +1435,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
// involved (impls rarely have more than a few bounds) means that it
// shouldn't matter in practice.
fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
vec.sort_unstable_by(|first, second| {
format!("{:?}", first).cmp(&format!("{:?}", second))
});
vec.sort_by_cached_key(|x| format!("{:?}", x))
}
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {

View File

@ -20,6 +20,7 @@
#![feature(box_syntax)]
#![feature(fs_read_write)]
#![feature(set_stdio)]
#![feature(slice_sort_by_cached_key)]
#![feature(test)]
#![feature(unicode)]
#![feature(vec_remove_item)]