mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +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>;
|
type Item = Rc<Page>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Rc<Page>> {
|
fn next(&mut self) -> Option<Rc<Page>> {
|
||||||
match self.stack.pop() {
|
let popped = self.stack.pop();
|
||||||
Some(next) => {
|
if let Some(ref page) = popped {
|
||||||
for child in &*next.children.borrow() {
|
self.stack.extend(page.children.borrow().iter().cloned());
|
||||||
self.stack.push(child.clone());
|
|
||||||
}
|
|
||||||
Some(next)
|
|
||||||
},
|
|
||||||
None => None,
|
|
||||||
}
|
}
|
||||||
|
popped
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue