mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Make [clippy::dump]
support trait items
This commit is contained in:
parent
8a9860901f
commit
c642cfe3bf
1 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
use clippy_utils::get_attr;
|
||||
use hir::TraitItem;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
@ -47,6 +48,18 @@ impl<'tcx> LateLintPass<'tcx> for DumpHir {
|
|||
println!("{stmt:#?}");
|
||||
}
|
||||
}
|
||||
|
||||
fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &TraitItem<'_>) {
|
||||
if has_attr(cx, item.hir_id()) {
|
||||
println!("{item:#?}");
|
||||
}
|
||||
}
|
||||
|
||||
fn check_impl_item(&mut self, cx: &LateContext<'_>, item: &hir::ImplItem<'_>) {
|
||||
if has_attr(cx, item.hir_id()) {
|
||||
println!("{item:#?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn has_attr(cx: &LateContext<'_>, hir_id: hir::HirId) -> bool {
|
||||
|
|
Loading…
Reference in a new issue