diff options
| author | Michael Wright <mikerite@lavabit.com> | 2020-06-11 20:25:14 +0200 |
|---|---|---|
| committer | Michael Wright <mikerite@lavabit.com> | 2020-06-23 07:51:51 +0200 |
| commit | 52c486475774b7416e691323322ef1ea2db790de (patch) | |
| tree | 254e836cfb34082e492fa519d1f2e348bbaa612b | |
| parent | fa0f6a8dbf049cbae679dc82d653371c5a8c0be4 (diff) | |
| download | rust-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.rs | 2 |
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; } |
