Auto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr

Improve end of expression check in for loop lints

changelog: none
This commit is contained in:
bors 2020-06-23 14:05:45 +00:00
commit c420382ac2

View file

@ -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;
}