diff options
| author | xFrednet <xFrednet@gmail.com> | 2023-02-04 19:10:19 +0100 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2023-02-04 19:34:31 +0100 |
| commit | c642cfe3bf245ffe34f6e994f0b359b267be5e3d (patch) | |
| tree | 98a20d0b42c8a3f5a9a354988c21129242e81d16 | |
| parent | 8a9860901f0ae9782ff23fb793838a16f733a60b (diff) | |
| download | rust-c642cfe3bf245ffe34f6e994f0b359b267be5e3d.tar.gz rust-c642cfe3bf245ffe34f6e994f0b359b267be5e3d.zip | |
Make `[clippy::dump]` support trait items
| -rw-r--r-- | clippy_lints/src/utils/dump_hir.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clippy_lints/src/utils/dump_hir.rs b/clippy_lints/src/utils/dump_hir.rs index 01efc527a8c..092041aecf2 100644 --- a/clippy_lints/src/utils/dump_hir.rs +++ b/clippy_lints/src/utils/dump_hir.rs @@ -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 { |
