about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/internal.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-01-02 23:32:40 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-01-06 01:25:20 +0300
commit90d11d64486bc758ee15a1dd5dba351447648097 (patch)
tree5a1e15c159733163020096bdc77055b072ca2ed9 /compiler/rustc_lint/src/internal.rs
parentb8c207435c85955d0c0806240d5491f5ccd1def5 (diff)
downloadrust-90d11d64486bc758ee15a1dd5dba351447648097.tar.gz
rust-90d11d64486bc758ee15a1dd5dba351447648097.zip
rustc_span: Optimize syntax context comparisons
Including comparisons with root context
Diffstat (limited to 'compiler/rustc_lint/src/internal.rs')
-rw-r--r--compiler/rustc_lint/src/internal.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 53d99c7f7f3..e3405aa2e55 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -549,7 +549,9 @@ declare_lint_pass!(SpanUseEqCtxt => [SPAN_USE_EQ_CTXT]);
 
 impl<'tcx> LateLintPass<'tcx> for SpanUseEqCtxt {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
-        if let ExprKind::Binary(BinOp { node: BinOpKind::Eq, .. }, lhs, rhs) = expr.kind {
+        if let ExprKind::Binary(BinOp { node: BinOpKind::Eq | BinOpKind::Ne, .. }, lhs, rhs) =
+            expr.kind
+        {
             if is_span_ctxt_call(cx, lhs) && is_span_ctxt_call(cx, rhs) {
                 cx.emit_spanned_lint(SPAN_USE_EQ_CTXT, expr.span, SpanUseEqCtxtDiag);
             }