stop linting [blocks_in_conditions] on match on proc macros
This commit is contained in:
parent
92537a0e5b
commit
4cc7b7e092
3 changed files with 4 additions and 10 deletions
|
|
@ -2,7 +2,7 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
|||
use clippy_utils::source::snippet_block_with_applicability;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use clippy_utils::visitors::{for_each_expr, Descend};
|
||||
use clippy_utils::{get_parent_expr, higher};
|
||||
use clippy_utils::{get_parent_expr, higher, is_from_proc_macro};
|
||||
use core::ops::ControlFlow;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{BlockCheckMode, Expr, ExprKind, MatchSource};
|
||||
|
|
@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for BlocksInConditions {
|
|||
}
|
||||
} else {
|
||||
let span = block.expr.as_ref().map_or_else(|| block.stmts[0].span, |e| e.span);
|
||||
if span.from_expansion() || expr.span.from_expansion() {
|
||||
if span.from_expansion() || expr.span.from_expansion() || is_from_proc_macro(cx, cond) {
|
||||
return;
|
||||
}
|
||||
// move block higher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue