Skip to content

Commit fb0e585

Browse files
committed
Simplify Postorder::next
1 parent 82e251b commit fb0e585

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/rustc_middle/src/mir/traversal.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,10 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> {
192192
type Item = (BasicBlock, &'a BasicBlockData<'tcx>);
193193

194194
fn next(&mut self) -> Option<(BasicBlock, &'a BasicBlockData<'tcx>)> {
195-
let next = self.visit_stack.pop();
196-
if next.is_some() {
197-
self.traverse_successor();
198-
}
199-
200-
next.map(|(bb, _)| (bb, &self.basic_blocks[bb]))
195+
let (bb, _) = self.visit_stack.pop()?;
196+
self.traverse_successor();
197+
198+
Some((bb, &self.basic_blocks[bb]))
201199
}
202200

203201
fn size_hint(&self) -> (usize, Option<usize>) {

0 commit comments

Comments
 (0)