@@ -1536,9 +1536,7 @@ pub struct Resolver<'a> {
1536
1536
extern_module_map : FxHashMap < ( DefId , bool /* MacrosOnly? */ ) , Module < ' a > > ,
1537
1537
binding_parent_modules : FxHashMap < PtrKey < ' a , NameBinding < ' a > > , Module < ' a > > ,
1538
1538
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.
1542
1540
pub glob_map : GlobMap ,
1543
1541
1544
1542
used_imports : FxHashSet < ( NodeId , Namespace ) > ,
@@ -1785,7 +1783,6 @@ impl<'a> Resolver<'a> {
1785
1783
cstore : & ' a CStore ,
1786
1784
krate : & Crate ,
1787
1785
crate_name : & str ,
1788
- make_glob_map : MakeGlobMap ,
1789
1786
crate_loader : & ' a mut CrateLoader < ' a > ,
1790
1787
arenas : & ' a ResolverArenas < ' a > )
1791
1788
-> Resolver < ' a > {
@@ -1869,7 +1866,6 @@ impl<'a> Resolver<'a> {
1869
1866
extern_module_map : FxHashMap :: default ( ) ,
1870
1867
binding_parent_modules : FxHashMap :: default ( ) ,
1871
1868
1872
- make_glob_map : make_glob_map == MakeGlobMap :: Yes ,
1873
1869
glob_map : Default :: default ( ) ,
1874
1870
1875
1871
used_imports : FxHashSet :: default ( ) ,
@@ -1979,14 +1975,15 @@ impl<'a> Resolver<'a> {
1979
1975
used. set ( true ) ;
1980
1976
directive. used . set ( true ) ;
1981
1977
self . used_imports . insert ( ( directive. id , ns) ) ;
1982
- self . add_to_glob_map ( directive. id , ident) ;
1978
+ self . add_to_glob_map ( & directive, ident) ;
1983
1979
self . record_use ( ident, ns, binding, false ) ;
1984
1980
}
1985
1981
}
1986
1982
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 ) ;
1990
1987
}
1991
1988
}
1992
1989
@@ -4528,7 +4525,7 @@ impl<'a> Resolver<'a> {
4528
4525
let import_id = match binding. kind {
4529
4526
NameBindingKind :: Import { directive, .. } => {
4530
4527
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) ;
4532
4529
Some ( directive. id )
4533
4530
}
4534
4531
_ => None ,
@@ -5232,12 +5229,6 @@ fn err_path_resolution() -> PathResolution {
5232
5229
PathResolution :: new ( Def :: Err )
5233
5230
}
5234
5231
5235
- #[ derive( PartialEq , Copy , Clone ) ]
5236
- pub enum MakeGlobMap {
5237
- Yes ,
5238
- No ,
5239
- }
5240
-
5241
5232
#[ derive( Copy , Clone , Debug ) ]
5242
5233
enum CrateLint {
5243
5234
/// Do not issue the lint
0 commit comments