@@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5959 base_use_tree : Option < & ' a ast:: UseTree > ,
6060 base_id : ast:: NodeId ,
6161 item_span : Span ,
62- base_use_is_pub : bool ,
6362}
6463
6564struct ExternCrateToLint {
@@ -146,7 +145,6 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
146145 // because this means that they were generated in some fashion by the
147146 // compiler and we don't need to consider them.
148147 ast:: ItemKind :: Use ( ..) if item. span . is_dummy ( ) => return ,
149- ast:: ItemKind :: Use ( ..) => self . base_use_is_pub = item. vis . kind . is_pub ( ) ,
150148 ast:: ItemKind :: ExternCrate ( orig_name) => {
151149 self . extern_crate_items . push ( ExternCrateToLint {
152150 id : item. id ,
@@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
173171 self . base_use_tree = Some ( use_tree) ;
174172 }
175173
176- if self . base_use_is_pub {
174+ if self . r . effective_visibilities . is_exported ( self . r . local_def_id ( id ) ) {
177175 self . check_import_as_underscore ( use_tree, id) ;
178176 return ;
179177 }
@@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
332330 base_use_tree : None ,
333331 base_id : ast:: DUMMY_NODE_ID ,
334332 item_span : DUMMY_SP ,
335- base_use_is_pub : false ,
336333 } ;
337334 visit:: walk_crate ( & mut visitor, krate) ;
338335
0 commit comments