Corrected explicit_counter_loop missing lints if variable used after loop
This commit is contained in:
parent
4b668159d2
commit
edfa9feac2
2 changed files with 36 additions and 9 deletions
|
|
@ -1996,6 +1996,9 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
|
|||
if self.state == VarState::DontWarn {
|
||||
return;
|
||||
}
|
||||
if self.past_loop {
|
||||
return;
|
||||
}
|
||||
if SpanlessEq::new(self.cx).eq_expr(&expr, self.end_expr) {
|
||||
self.past_loop = true;
|
||||
return;
|
||||
|
|
@ -2024,12 +2027,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
|
|||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
if self.past_loop {
|
||||
self.state = VarState::DontWarn;
|
||||
return;
|
||||
}
|
||||
} else if !self.past_loop && is_loop(expr) {
|
||||
} else if is_loop(expr) {
|
||||
self.state = VarState::DontWarn;
|
||||
return;
|
||||
} else if is_conditional(expr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue