Skip to content

Commit f411c18

Browse files
committed
check macro_backtrace only
1 parent 697c75e commit f411c18

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clippy_lints/src/copies.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use clippy_utils::{
88
use core::iter;
99
use rustc_errors::Applicability;
1010
use rustc_hir::intravisit;
11-
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, QPath, Stmt, StmtKind};
11+
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, Stmt, StmtKind};
1212
use rustc_lint::{LateContext, LateLintPass};
1313
use rustc_session::{declare_lint_pass, declare_tool_lint};
1414
use rustc_span::hygiene::walk_chain;
@@ -389,13 +389,11 @@ fn contains_acceptable_macro(cx: &LateContext<'_>, block: &Block<'_>) -> bool {
389389
}
390390

391391
fn acceptable_macro(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
392-
if let ExprKind::Call(call_expr, _) = expr.kind
393-
&& let ExprKind::Path(QPath::Resolved(None, path)) = call_expr.kind
394-
&& macro_backtrace(path.span).last().map_or(false, |macro_call|
395-
matches!(
396-
&cx.tcx.get_diagnostic_name(macro_call.def_id),
397-
Some(sym::todo_macro | sym::unimplemented_macro)
398-
)
392+
if macro_backtrace(expr.span).last().map_or(false, |macro_call|
393+
matches!(
394+
&cx.tcx.get_diagnostic_name(macro_call.def_id),
395+
Some(sym::todo_macro | sym::unimplemented_macro)
396+
)
399397
) {
400398
return true;
401399
}

0 commit comments

Comments
 (0)