`rustc_mir_build`: drive-by-cleanup: remove some local mutable state

This commit is contained in:
Maybe Waffle 2022-11-21 13:44:52 +00:00
parent c2ccc855e7
commit 5ae51d69a3
1 changed files with 6 additions and 6 deletions

View File

@ -671,12 +671,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} else {
self.scopes.breakable_scopes[break_index].continue_drops.as_mut().unwrap()
};
let mut drop_idx = ROOT_NODE;
for scope in &self.scopes.scopes[scope_index + 1..] {
for drop in &scope.drops {
drop_idx = drops.add_drop(*drop, drop_idx);
}
}
let drop_idx = self.scopes.scopes[scope_index + 1..]
.iter()
.flat_map(|scope| &scope.drops)
.fold(ROOT_NODE, |drop_idx, &drop| drops.add_drop(drop, drop_idx));
drops.add_entry(block, drop_idx);
// `build_drop_trees` doesn't have access to our source_info, so we