@@ -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
@@ -4551,7 +4548,7 @@ impl<'a> Resolver<'a> {
4551
4548
let import_id = match binding. kind {
4552
4549
NameBindingKind :: Import { directive, .. } => {
4553
4550
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) ;
4555
4552
Some ( directive. id )
4556
4553
}
4557
4554
_ => None ,
@@ -5255,12 +5252,6 @@ fn err_path_resolution() -> PathResolution {
5255
5252
PathResolution :: new ( Def :: Err )
5256
5253
}
5257
5254
5258
- #[ derive( PartialEq , Copy , Clone ) ]
5259
- pub enum MakeGlobMap {
5260
- Yes ,
5261
- No ,
5262
- }
5263
-
5264
5255
#[ derive( Copy , Clone , Debug ) ]
5265
5256
enum CrateLint {
5266
5257
/// Do not issue the lint
0 commit comments