fix: false positive double_negations when it jumps macro boundary

This commit is contained in:
anatawa12
2025-07-16 15:39:31 +09:00
parent 3014e79f9c
commit fad8dec970
3 changed files with 38 additions and 0 deletions

View File

@@ -1584,6 +1584,8 @@ impl EarlyLintPass for DoubleNegations {
if let ExprKind::Unary(UnOp::Neg, ref inner) = expr.kind
&& let ExprKind::Unary(UnOp::Neg, ref inner2) = inner.kind
&& !matches!(inner2.kind, ExprKind::Unary(UnOp::Neg, _))
// Don't lint if this jumps macro expansion boundary (Issue #143980)
&& expr.span.eq_ctxt(inner.span)
{
cx.emit_span_lint(
DOUBLE_NEGATIONS,