mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Cleanup PageIterator::next.
This commit is contained in:
parent
adc493ccce
commit
8fe798d439
1 changed files with 8 additions and 8 deletions
|
@ -270,14 +270,14 @@ impl Page {
|
|||
|
||||
impl Iterator<Rc<Page>> for PageIterator {
|
||||
fn next(&mut self) -> Option<Rc<Page>> {
|
||||
if !self.stack.is_empty() {
|
||||
let next = self.stack.pop().unwrap();
|
||||
for child in next.children.borrow().iter() {
|
||||
self.stack.push(child.clone());
|
||||
}
|
||||
Some(next.clone())
|
||||
} else {
|
||||
None
|
||||
match self.stack.pop() {
|
||||
Some(next) => {
|
||||
for child in next.children.borrow().iter() {
|
||||
self.stack.push(child.clone());
|
||||
}
|
||||
Some(next)
|
||||
},
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue