File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 23
23
#![ cfg_attr( unix, feature( libc) ) ]
24
24
#![ feature( quote) ]
25
25
#![ feature( rustc_diagnostic_macros) ]
26
+ #![ feature( slice_sort_by_cached_key) ]
26
27
#![ feature( set_stdio) ]
27
28
#![ feature( rustc_stack_internals) ]
28
29
@@ -83,7 +84,6 @@ use rustc_trans_utils::trans_crate::TransCrate;
83
84
use serialize:: json:: ToJson ;
84
85
85
86
use std:: any:: Any ;
86
- use std:: cmp:: Ordering :: Equal ;
87
87
use std:: cmp:: max;
88
88
use std:: default:: Default ;
89
89
use std:: env:: consts:: { DLL_PREFIX , DLL_SUFFIX } ;
@@ -1177,13 +1177,8 @@ Available lint options:
1177
1177
1178
1178
fn sort_lints ( sess : & Session , lints : Vec < ( & ' static Lint , bool ) > ) -> Vec < & ' static Lint > {
1179
1179
let mut lints: Vec < _ > = lints. into_iter ( ) . map ( |( x, _) | x) . collect ( ) ;
1180
- lints. sort_by ( |x : & & Lint , y : & & Lint | {
1181
- match x. default_level ( sess) . cmp ( & y. default_level ( sess) ) {
1182
- // The sort doesn't case-fold but it's doubtful we care.
1183
- Equal => x. name . cmp ( y. name ) ,
1184
- r => r,
1185
- }
1186
- } ) ;
1180
+ // The sort doesn't case-fold but it's doubtful we care.
1181
+ lints. sort_by_cached_key ( |x : & & Lint | ( x. default_level ( sess) , x. name ) ) ;
1187
1182
lints
1188
1183
}
1189
1184
Original file line number Diff line number Diff line change 22
22
23
23
#![ feature( unicode) ]
24
24
#![ feature( rustc_diagnostic_macros) ]
25
+ #![ feature( slice_sort_by_cached_key) ]
25
26
#![ feature( non_exhaustive) ]
26
27
#![ feature( const_atomic_usize_new) ]
27
28
#![ feature( rustc_attrs) ]
Original file line number Diff line number Diff line change @@ -689,7 +689,7 @@ impl<'a> Parser<'a> {
689
689
. chain ( inedible. iter ( ) . map ( |x| TokenType :: Token ( x. clone ( ) ) ) )
690
690
. chain ( self . expected_tokens . iter ( ) . cloned ( ) )
691
691
. collect :: < Vec < _ > > ( ) ;
692
- expected. sort_by ( |a , b| a . to_string ( ) . cmp ( & b . to_string ( ) ) ) ;
692
+ expected. sort_by_cached_key ( |x| x . to_string ( ) ) ;
693
693
expected. dedup ( ) ;
694
694
let expect = tokens_to_string ( & expected[ ..] ) ;
695
695
let actual = self . this_token_to_string ( ) ;
You can’t perform that action at this time.
0 commit comments