Skip to content

Commit 5ae51d6

Browse files
committed
rustc_mir_build: drive-by-cleanup: remove some local mutable state
1 parent c2ccc85 commit 5ae51d6

File tree

1 file changed

+6
-6
lines changed
  • compiler/rustc_mir_build/src/build

1 file changed

+6
-6
lines changed

compiler/rustc_mir_build/src/build/scope.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
671671
} else {
672672
self.scopes.breakable_scopes[break_index].continue_drops.as_mut().unwrap()
673673
};
674-
let mut drop_idx = ROOT_NODE;
675-
for scope in &self.scopes.scopes[scope_index + 1..] {
676-
for drop in &scope.drops {
677-
drop_idx = drops.add_drop(*drop, drop_idx);
678-
}
679-
}
674+
675+
let drop_idx = self.scopes.scopes[scope_index + 1..]
676+
.iter()
677+
.flat_map(|scope| &scope.drops)
678+
.fold(ROOT_NODE, |drop_idx, &drop| drops.add_drop(drop, drop_idx));
679+
680680
drops.add_entry(block, drop_idx);
681681

682682
// `build_drop_trees` doesn't have access to our source_info, so we

0 commit comments

Comments
 (0)