|
1 | 1 | use clippy_utils::diagnostics::span_lint_and_sugg; |
| 2 | +use clippy_utils::is_in_test; |
2 | 3 | use clippy_utils::macros::{macro_backtrace, MacroCall}; |
3 | 4 | use clippy_utils::source::snippet_with_applicability; |
4 | | -use clippy_utils::{is_in_cfg_test, is_in_test_function}; |
5 | 5 | use rustc_data_structures::fx::FxHashSet; |
6 | 6 | use rustc_errors::Applicability; |
7 | | -use rustc_hir::{Expr, ExprKind, HirId, Node}; |
| 7 | +use rustc_hir::{Expr, ExprKind, Node}; |
8 | 8 | use rustc_lint::{LateContext, LateLintPass, LintContext}; |
9 | 9 | use rustc_middle::lint::in_external_macro; |
10 | 10 | use rustc_session::impl_lint_pass; |
@@ -63,7 +63,7 @@ impl LateLintPass<'_> for DbgMacro { |
63 | 63 | !in_external_macro(cx.sess(), macro_call.span) && |
64 | 64 | self.checked_dbg_call_site.insert(macro_call.span) && |
65 | 65 | // allows `dbg!` in test code if allow-dbg-in-test is set to true in clippy.toml |
66 | | - !(self.allow_dbg_in_tests && is_in_test(cx, expr.hir_id)) |
| 66 | + !(self.allow_dbg_in_tests && is_in_test(cx.tcx, expr.hir_id)) |
67 | 67 | { |
68 | 68 | let mut applicability = Applicability::MachineApplicable; |
69 | 69 |
|
@@ -129,10 +129,6 @@ impl LateLintPass<'_> for DbgMacro { |
129 | 129 | } |
130 | 130 | } |
131 | 131 |
|
132 | | -fn is_in_test(cx: &LateContext<'_>, hir_id: HirId) -> bool { |
133 | | - is_in_test_function(cx.tcx, hir_id) || is_in_cfg_test(cx.tcx, hir_id) |
134 | | -} |
135 | | - |
136 | 132 | fn first_dbg_macro_in_expansion(cx: &LateContext<'_>, span: Span) -> Option<MacroCall> { |
137 | 133 | macro_backtrace(span).find(|mc| cx.tcx.is_diagnostic_item(sym::dbg_macro, mc.def_id)) |
138 | 134 | } |
0 commit comments