diff options
| author | varkor <github@varkor.com> | 2018-03-30 10:44:12 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-04-09 16:44:05 +0100 |
| commit | 5cd0504d10230ec82ad1a6447db590a77b0eadb7 (patch) | |
| tree | 7784a5b25fc1958a80a20639a436c539aa52dae1 | |
| parent | d3fe534fcf64f35be4285fcd0b04504b3713b628 (diff) | |
| download | rust-5cd0504d10230ec82ad1a6447db590a77b0eadb7.tar.gz rust-5cd0504d10230ec82ad1a6447db590a77b0eadb7.zip | |
Convert sort_unstable_by to sort_by_cached_key
| -rw-r--r-- | src/librustdoc/clean/auto_trait.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index a87e1df5efc..322527839e0 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -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 { diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 42e87f88fd4..e34cf6222cf 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -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)] |
