@@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
59
59
base_use_tree : Option < & ' a ast:: UseTree > ,
60
60
base_id : ast:: NodeId ,
61
61
item_span : Span ,
62
- base_use_is_pub : bool ,
63
62
}
64
63
65
64
struct ExternCrateToLint {
@@ -146,7 +145,6 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
146
145
// because this means that they were generated in some fashion by the
147
146
// compiler and we don't need to consider them.
148
147
ast:: ItemKind :: Use ( ..) if item. span . is_dummy ( ) => return ,
149
- ast:: ItemKind :: Use ( ..) => self . base_use_is_pub = item. vis . kind . is_pub ( ) ,
150
148
ast:: ItemKind :: ExternCrate ( orig_name) => {
151
149
self . extern_crate_items . push ( ExternCrateToLint {
152
150
id : item. id ,
@@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
173
171
self . base_use_tree = Some ( use_tree) ;
174
172
}
175
173
176
- if self . base_use_is_pub {
174
+ if self . r . effective_visibilities . is_exported ( self . r . local_def_id ( id ) ) {
177
175
self . check_import_as_underscore ( use_tree, id) ;
178
176
return ;
179
177
}
@@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
332
330
base_use_tree : None ,
333
331
base_id : ast:: DUMMY_NODE_ID ,
334
332
item_span : DUMMY_SP ,
335
- base_use_is_pub : false ,
336
333
} ;
337
334
visit:: walk_crate ( & mut visitor, krate) ;
338
335
0 commit comments