mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 07:30:57 +00:00
check macro_backtrace only
This commit is contained in:
parent
697c75ef4b
commit
f411c18a73
1 changed files with 6 additions and 8 deletions
|
@ -8,7 +8,7 @@ use clippy_utils::{
|
|||
use core::iter;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::intravisit;
|
||||
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, QPath, Stmt, StmtKind};
|
||||
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, Stmt, StmtKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::hygiene::walk_chain;
|
||||
|
@ -389,13 +389,11 @@ fn contains_acceptable_macro(cx: &LateContext<'_>, block: &Block<'_>) -> bool {
|
|||
}
|
||||
|
||||
fn acceptable_macro(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
if let ExprKind::Call(call_expr, _) = expr.kind
|
||||
&& let ExprKind::Path(QPath::Resolved(None, path)) = call_expr.kind
|
||||
&& macro_backtrace(path.span).last().map_or(false, |macro_call|
|
||||
matches!(
|
||||
&cx.tcx.get_diagnostic_name(macro_call.def_id),
|
||||
Some(sym::todo_macro | sym::unimplemented_macro)
|
||||
)
|
||||
if macro_backtrace(expr.span).last().map_or(false, |macro_call|
|
||||
matches!(
|
||||
&cx.tcx.get_diagnostic_name(macro_call.def_id),
|
||||
Some(sym::todo_macro | sym::unimplemented_macro)
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue