1
Fork 0

Rollup merge of #77739 - est31:remove_unused_code, r=petrochenkov,varkor

Remove unused code

Rustc has a builtin lint for detecting unused code inside a crate, but when an item is marked `pub`, the code, even if unused inside the entire workspace, is never marked as such. Therefore, I've built [warnalyzer](https://github.com/est31/warnalyzer) to detect unused items in a cross-crate setting.

Closes https://github.com/est31/warnalyzer/issues/2
This commit is contained in:
Yuki Okushi 2020-10-15 07:32:29 +09:00 committed by GitHub
commit 022d20759b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 8 additions and 684 deletions

View file

@ -44,9 +44,6 @@ pub trait PpAnn {
fn nested(&self, _state: &mut State<'_>, _nested: Nested) {}
fn pre(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {}
fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {}
fn try_fetch_item(&self, _: hir::HirId) -> Option<&hir::Item<'_>> {
None
}
}
pub struct NoAnn;
@ -54,9 +51,6 @@ impl PpAnn for NoAnn {}
pub const NO_ANN: &dyn PpAnn = &NoAnn;
impl PpAnn for hir::Crate<'_> {
fn try_fetch_item(&self, item: hir::HirId) -> Option<&hir::Item<'_>> {
Some(self.item(item))
}
fn nested(&self, state: &mut State<'_>, nested: Nested) {
match nested {
Nested::Item(id) => state.print_item(self.item(id.id)),