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

View File

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