@@ -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
@@ -4551,7 +4548,7 @@ impl<'a> Resolver<'a> {
45514548 let import_id = match binding. kind {
45524549 NameBindingKind :: Import { directive, .. } => {
45534550 self . maybe_unused_trait_imports . insert ( directive. id ) ;
4554- self . add_to_glob_map ( directive. id , trait_name) ;
4551+ self . add_to_glob_map ( & directive, trait_name) ;
45554552 Some ( directive. id )
45564553 }
45574554 _ => None ,
@@ -5255,12 +5252,6 @@ fn err_path_resolution() -> PathResolution {
52555252 PathResolution :: new ( Def :: Err )
52565253}
52575254
5258- #[ derive( PartialEq , Copy , Clone ) ]
5259- pub enum MakeGlobMap {
5260- Yes ,
5261- No ,
5262- }
5263-
52645255#[ derive( Copy , Clone , Debug ) ]
52655256enum CrateLint {
52665257 /// Do not issue the lint
0 commit comments