File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2630,14 +2630,14 @@ impl ClashingExternDeclarations {
26302630 let local_did = tcx. hir ( ) . local_def_id ( fi. hir_id ) ;
26312631 let did = local_did. to_def_id ( ) ;
26322632 let instance = Instance :: new ( did, ty:: List :: identity_for_item ( tcx, did) ) ;
2633- let name = tcx. symbol_name ( instance) . name . to_string ( ) ;
2634- if self . seen_decls . contains_key ( & name) {
2633+ let name = tcx. symbol_name ( instance) . name ;
2634+ if let Some ( & hir_id ) = self . seen_decls . get ( name) {
26352635 // Avoid updating the map with the new entry when we do find a collision. We want to
26362636 // make sure we're always pointing to the first definition as the previous declaration.
26372637 // This lets us avoid emitting "knock-on" diagnostics.
2638- Some ( * self . seen_decls . get ( & name ) . unwrap ( ) )
2638+ Some ( hir_id )
26392639 } else {
2640- self . seen_decls . insert ( name, hid)
2640+ self . seen_decls . insert ( name. to_owned ( ) , hid)
26412641 }
26422642 }
26432643
You can’t perform that action at this time.
0 commit comments