Skip to content

Commit c642cfe

Browse files
committed
Make [clippy::dump] support trait items
1 parent 8a98609 commit c642cfe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

clippy_lints/src/utils/dump_hir.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use clippy_utils::get_attr;
2+
use hir::TraitItem;
23
use rustc_hir as hir;
34
use rustc_lint::{LateContext, LateLintPass, LintContext};
45
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -47,6 +48,18 @@ impl<'tcx> LateLintPass<'tcx> for DumpHir {
4748
println!("{stmt:#?}");
4849
}
4950
}
51+
52+
fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &TraitItem<'_>) {
53+
if has_attr(cx, item.hir_id()) {
54+
println!("{item:#?}");
55+
}
56+
}
57+
58+
fn check_impl_item(&mut self, cx: &LateContext<'_>, item: &hir::ImplItem<'_>) {
59+
if has_attr(cx, item.hir_id()) {
60+
println!("{item:#?}");
61+
}
62+
}
5063
}
5164

5265
fn has_attr(cx: &LateContext<'_>, hir_id: hir::HirId) -> bool {

0 commit comments

Comments
 (0)