Skip to content

Commit 05c48a3

Browse files
committed
fix: don't warn double-negations when it jumps macro boundary
1 parent c48d6b0 commit 05c48a3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,8 @@ impl EarlyLintPass for DoubleNegations {
15841584
if let ExprKind::Unary(UnOp::Neg, ref inner) = expr.kind
15851585
&& let ExprKind::Unary(UnOp::Neg, ref inner2) = inner.kind
15861586
&& !matches!(inner2.kind, ExprKind::Unary(UnOp::Neg, _))
1587+
// Don't lint if this jumps macro expansion boundary (Issue #143980)
1588+
&& expr.span.eq_ctxt(inner.span)
15871589
{
15881590
cx.emit_span_lint(
15891591
DOUBLE_NEGATIONS,

0 commit comments

Comments
 (0)