@@ -1536,9 +1536,7 @@ pub struct Resolver<'a> {
15361536 extern_module_map : FxHashMap < ( DefId , bool /* MacrosOnly? */ ) , Module < ' a > > ,
15371537 binding_parent_modules : FxHashMap < PtrKey < ' a , NameBinding < ' a > > , Module < ' a > > ,
15381538
1539- pub make_glob_map : bool ,
1540- /// Maps imports to the names of items actually imported (this actually maps
1541- /// all imports, but only glob imports are actually interesting).
1539+ /// Maps glob imports to the names of items actually imported.
15421540 pub glob_map : GlobMap ,
15431541
15441542 used_imports : FxHashSet < ( NodeId , Namespace ) > ,
@@ -1785,7 +1783,6 @@ impl<'a> Resolver<'a> {
17851783 cstore : & ' a CStore ,
17861784 krate : & Crate ,
17871785 crate_name : & str ,
1788- make_glob_map : MakeGlobMap ,
17891786 crate_loader : & ' a mut CrateLoader < ' a > ,
17901787 arenas : & ' a ResolverArenas < ' a > )
17911788 -> Resolver < ' a > {
@@ -1869,7 +1866,6 @@ impl<'a> Resolver<'a> {
18691866 extern_module_map : FxHashMap :: default ( ) ,
18701867 binding_parent_modules : FxHashMap :: default ( ) ,
18711868
1872- make_glob_map : make_glob_map == MakeGlobMap :: Yes ,
18731869 glob_map : Default :: default ( ) ,
18741870
18751871 used_imports : FxHashSet :: default ( ) ,
@@ -1979,14 +1975,15 @@ impl<'a> Resolver<'a> {
19791975 used. set ( true ) ;
19801976 directive. used . set ( true ) ;
19811977 self . used_imports . insert ( ( directive. id , ns) ) ;
1982- self . add_to_glob_map ( directive. id , ident) ;
1978+ self . add_to_glob_map ( & directive, ident) ;
19831979 self . record_use ( ident, ns, binding, false ) ;
19841980 }
19851981 }
19861982
1987- fn add_to_glob_map ( & mut self , id : NodeId , ident : Ident ) {
1988- if self . make_glob_map {
1989- self . glob_map . entry ( id) . or_default ( ) . insert ( ident. name ) ;
1983+ #[ inline]
1984+ fn add_to_glob_map ( & mut self , directive : & ImportDirective < ' _ > , ident : Ident ) {
1985+ if directive. is_glob ( ) {
1986+ self . glob_map . entry ( directive. id ) . or_default ( ) . insert ( ident. name ) ;
19901987 }
19911988 }
19921989
@@ -4528,7 +4525,7 @@ impl<'a> Resolver<'a> {
45284525 let import_id = match binding. kind {
45294526 NameBindingKind :: Import { directive, .. } => {
45304527 self . maybe_unused_trait_imports . insert ( directive. id ) ;
4531- self . add_to_glob_map ( directive. id , trait_name) ;
4528+ self . add_to_glob_map ( & directive, trait_name) ;
45324529 Some ( directive. id )
45334530 }
45344531 _ => None ,
@@ -5232,12 +5229,6 @@ fn err_path_resolution() -> PathResolution {
52325229 PathResolution :: new ( Def :: Err )
52335230}
52345231
5235- #[ derive( PartialEq , Copy , Clone ) ]
5236- pub enum MakeGlobMap {
5237- Yes ,
5238- No ,
5239- }
5240-
52415232#[ derive( Copy , Clone , Debug ) ]
52425233enum CrateLint {
52435234 /// Do not issue the lint
0 commit comments