Skip to content

Commit 0e0dc59

Browse files
committed
Use and_then instead of while let chain to clarify iter scope
1 parent e0abb98 commit 0e0dc59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_middle/src/mir/traversal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> {
178178
// When we yield `C` and call `traverse_successor`, we push `B` to the stack, but
179179
// since we've already visited `E`, that child isn't added to the stack. The last
180180
// two iterations yield `B` and finally `A` for a final traversal of [E, D, C, B, A]
181-
while let Some((_, iter)) = self.visit_stack.last_mut() && let Some(bb) = iter.next_back() {
181+
while let Some(bb) = self.visit_stack.last_mut().and_then(|(_, iter)| iter.next_back()) {
182182
if self.visited.insert(bb) {
183183
if let Some(term) = &self.basic_blocks[bb].terminator {
184184
self.visit_stack.push((bb, term.successors()));

0 commit comments

Comments
 (0)