Skip to content

Commit f97c38d

Browse files
committed
avoid op-ref in macros
Avoid running op-ref inspection in macros since the macro may be invoked in many different types of contexts. Solves #2818 and incidentally avoids #2689.
1 parent ce229b2 commit f97c38d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clippy_lints/src/eq_op.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ impl LintPass for EqOp {
5353
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
5454
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
5555
if let ExprBinary(ref op, ref left, ref right) = e.node {
56-
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) && !in_macro(e.span) {
56+
if in_macro(e.span) {
57+
return;
58+
}
59+
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) {
5760
span_lint(
5861
cx,
5962
EQ_OP,

0 commit comments

Comments
 (0)