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.
This commit is contained in:
parent
ce229b2025
commit
f97c38de94
1 changed files with 4 additions and 1 deletions
|
@ -53,7 +53,10 @@ impl LintPass for EqOp {
|
|||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
|
||||
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
|
||||
if let ExprBinary(ref op, ref left, ref right) = e.node {
|
||||
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) && !in_macro(e.span) {
|
||||
if in_macro(e.span) {
|
||||
return;
|
||||
}
|
||||
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) {
|
||||
span_lint(
|
||||
cx,
|
||||
EQ_OP,
|
||||
|
|
Loading…
Reference in a new issue