about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Wright <mikerite@lavabit.com>2020-06-11 20:25:14 +0200
committerMichael Wright <mikerite@lavabit.com>2020-06-23 07:51:51 +0200
commit52c486475774b7416e691323322ef1ea2db790de (patch)
tree254e836cfb34082e492fa519d1f2e348bbaa612b
parentfa0f6a8dbf049cbae679dc82d653371c5a8c0be4 (diff)
downloadrust-52c486475774b7416e691323322ef1ea2db790de.tar.gz
rust-52c486475774b7416e691323322ef1ea2db790de.zip
Improve end of expression check in for loop lints
The code should to check that the current expression _is_ the end
expression; not that it's equal to it. The equality check seems very
wasteful in terms of performance.
-rw-r--r--clippy_lints/src/loops.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index ae1aa66be5c..3874b040b13 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -2042,7 +2042,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
         if self.state == VarState::DontWarn {
             return;
         }
-        if SpanlessEq::new(self.cx).eq_expr(&expr, self.end_expr) {
+        if expr.hir_id == self.end_expr.hir_id {
             self.past_loop = true;
             return;
         }