mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
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.
This commit is contained in:
parent
fa0f6a8dbf
commit
52c4864757
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user