Rollup merge of #144008 - anatawa12:fix-double-negations, r=compiler-errors
Fix false positive double negations with macro invocation This PR fixes false positive double_negations lint when macro expansion has negation and macro caller also has negations. Fix rust-lang/rust#143980
This commit is contained in:
@@ -1585,6 +1585,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,
|
||||
|
||||
Reference in New Issue
Block a user