mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Cleanup PageIterator::next
This commit is contained in:
parent
1b20bc90ee
commit
bfc4ed4cac
1 changed files with 4 additions and 8 deletions
|
@ -100,15 +100,11 @@ impl Iterator for PageIterator {
|
|||
type Item = Rc<Page>;
|
||||
|
||||
fn next(&mut self) -> Option<Rc<Page>> {
|
||||
match self.stack.pop() {
|
||||
Some(next) => {
|
||||
for child in &*next.children.borrow() {
|
||||
self.stack.push(child.clone());
|
||||
}
|
||||
Some(next)
|
||||
},
|
||||
None => None,
|
||||
let popped = self.stack.pop();
|
||||
if let Some(ref page) = popped {
|
||||
self.stack.extend(page.children.borrow().iter().cloned());
|
||||
}
|
||||
popped
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue