@@ -67,7 +67,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
67
67
// them explicitly here.
68
68
ref attrs,
69
69
span,
70
-
71
70
// These fields are handled separately:
72
71
exported_macros : _,
73
72
items : _,
@@ -128,30 +127,27 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
128
127
cstore : & dyn CrateStore ,
129
128
source_map : & SourceMap ,
130
129
commandline_args_hash : u64 )
131
- -> ( Vec < Option < Entry < ' hir > > > , Svh ) {
132
- self . hir_body_nodes
133
- . sort_unstable_by ( | & ( ref d1 , _ ) , & ( ref d2 , _ ) | d1 . cmp ( d2 ) ) ;
130
+ -> ( Vec < Option < Entry < ' hir > > > , Svh )
131
+ {
132
+ self . hir_body_nodes . sort_unstable_by_key ( |bn| bn . 0 ) ;
134
133
135
134
let node_hashes = self
136
135
. hir_body_nodes
137
136
. iter ( )
138
- . fold ( Fingerprint :: ZERO , |fingerprint , & ( def_path_hash, dep_node_index) | {
137
+ . fold ( Fingerprint :: ZERO , |fingerprint, & ( def_path_hash, dep_node_index) | {
139
138
fingerprint. combine (
140
139
def_path_hash. 0 . combine ( self . dep_graph . fingerprint_of ( dep_node_index) )
141
140
)
142
141
} ) ;
143
142
144
143
let mut upstream_crates: Vec < _ > = cstore. crates_untracked ( ) . iter ( ) . map ( |& cnum| {
145
144
let name = cstore. crate_name_untracked ( cnum) . as_str ( ) ;
146
- let disambiguator = cstore. crate_disambiguator_untracked ( cnum)
147
- . to_fingerprint ( ) ;
145
+ let disambiguator = cstore. crate_disambiguator_untracked ( cnum) . to_fingerprint ( ) ;
148
146
let hash = cstore. crate_hash_untracked ( cnum) ;
149
147
( name, disambiguator, hash)
150
148
} ) . collect ( ) ;
151
149
152
- upstream_crates. sort_unstable_by ( |& ( name1, dis1, _) , & ( name2, dis2, _) | {
153
- ( name1, dis1) . cmp ( & ( name2, dis2) )
154
- } ) ;
150
+ upstream_crates. sort_unstable_by_key ( |& ( name, dis, _) | ( name, dis) ) ;
155
151
156
152
// We hash the final, remapped names of all local source files so we
157
153
// don't have to include the path prefix remapping commandline args.
@@ -229,7 +225,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
229
225
}
230
226
231
227
self . insert_entry ( id, entry) ;
232
-
233
228
}
234
229
235
230
fn with_parent < F : FnOnce ( & mut Self ) > ( & mut self , parent_id : NodeId , f : F ) {
@@ -311,14 +306,11 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
311
306
self . with_dep_node_owner ( i. hir_id . owner , i, |this| {
312
307
this. insert ( i. id , Node :: Item ( i) ) ;
313
308
this. with_parent ( i. id , |this| {
314
- match i. node {
315
- ItemKind :: Struct ( ref struct_def, _) => {
316
- // If this is a tuple-like struct, register the constructor.
317
- if !struct_def. is_struct ( ) {
318
- this. insert ( struct_def. id ( ) , Node :: StructCtor ( struct_def) ) ;
319
- }
309
+ if let ItemKind :: Struct ( ref struct_def, _) = i. node {
310
+ // If this is a tuple-like struct, register the constructor.
311
+ if !struct_def. is_struct ( ) {
312
+ this. insert ( struct_def. id ( ) , Node :: StructCtor ( struct_def) ) ;
320
313
}
321
- _ => { }
322
314
}
323
315
intravisit:: walk_item ( this, i) ;
324
316
} ) ;
0 commit comments