Skip to content

Commit 1f36aa5

Browse files
Darren TsungDarren Tsung
authored andcommitted
Check that eq_op lint doesn’t mark macro use of functions as errors since macros, fix #2265
1 parent 50eb48e commit 1f36aa5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/eq_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3-
use utils::{implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
3+
use utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
44

55
/// **What it does:** Checks for equal operands to comparison, logical and
66
/// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,
@@ -53,7 +53,7 @@ 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) {
56+
if !in_macro(e.span) && is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) {
5757
span_lint(
5858
cx,
5959
EQ_OP,

0 commit comments

Comments
 (0)