Skip to content
Permalink
Browse files

Walk all items for dead_code lint by default

  • Loading branch information...
varkor committed Mar 28, 2019
1 parent 40db575 commit 8cdfad91539dea8c9ec7d22c08f40e42e25e6ff0
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/librustc/middle/dead.rs
@@ -73,7 +73,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
Def::Const(_) | Def::AssociatedConst(..) | Def::TyAlias(_) => {
self.check_def_id(def.def_id());
}
_ if self.in_pat => (),
_ if self.in_pat => {},
Def::PrimTy(..) | Def::SelfTy(..) | Def::SelfCtor(..) |
Def::Local(..) | Def::Upvar(..) => {}
Def::Ctor(ctor_def_id, CtorOf::Variant, ..) => {
@@ -91,6 +91,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
self.check_def_id(variant_id);
}
}
Def::ToolMod | Def::NonMacroAttr(..) | Def::Err => {}
_ => {
self.check_def_id(def.def_id());
}
@@ -166,17 +167,13 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
}
hir::ItemKind::Enum(..) => {
self.inherited_pub_visibility = item.vis.node.is_pub();

intravisit::walk_item(self, &item);
}
hir::ItemKind::Fn(..)
| hir::ItemKind::Ty(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Existential(..)
| hir::ItemKind::Impl(..)
| hir::ItemKind::Const(..) => {
hir::ItemKind::ForeignMod(..) => {}
_ => {
intravisit::walk_item(self, &item);
}
_ => ()
}
}
Node::TraitItem(trait_item) => {
@@ -188,7 +185,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
Node::ForeignItem(foreign_item) => {
intravisit::walk_foreign_item(self, &foreign_item);
}
_ => ()
_ => {}
}
self.repr_has_repr_c = had_repr_c;
self.inherited_pub_visibility = had_inherited_pub_visibility;

0 comments on commit 8cdfad9

Please sign in to comment.
You can’t perform that action at this time.