Skip to content

Commit 5a90de8

Browse files
committed
Delete useless loop
1 parent 1c75724 commit 5a90de8

File tree

1 file changed

+8
-9
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+8
-9
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,17 @@ impl<'hir> Iterator for ParentHirIterator<'hir> {
7474
if self.current_id == CRATE_HIR_ID {
7575
return None;
7676
}
77-
loop {
78-
// There are nodes that do not have entries, so we need to skip them.
79-
let parent_id = self.map.parent_id(self.current_id);
8077

81-
if parent_id == self.current_id {
82-
self.current_id = CRATE_HIR_ID;
83-
return None;
84-
}
78+
// There are nodes that do not have entries, so we need to skip them.
79+
let parent_id = self.map.parent_id(self.current_id);
8580

86-
self.current_id = parent_id;
87-
return Some(parent_id);
81+
if parent_id == self.current_id {
82+
self.current_id = CRATE_HIR_ID;
83+
return None;
8884
}
85+
86+
self.current_id = parent_id;
87+
return Some(parent_id);
8988
}
9089
}
9190

0 commit comments

Comments
 (0)