aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/page.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-12-10 16:19:46 +0100
committerMs2ger <ms2ger@gmail.com>2014-12-10 16:24:13 +0100
commit8fe798d4398fcc73721fb4e01885bd94298a1409 (patch)
tree521af9b33df6942b8b67dee4175d086e1dc26a20 /components/script/page.rs
parentadc493ccce6797b5a34cb7b04740297122c1266f (diff)
downloadservo-8fe798d4398fcc73721fb4e01885bd94298a1409.tar.gz
servo-8fe798d4398fcc73721fb4e01885bd94298a1409.zip
Cleanup PageIterator::next.
Diffstat (limited to 'components/script/page.rs')
-rw-r--r--components/script/page.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/components/script/page.rs b/components/script/page.rs
index 62879424927..37f4ba155bb 100644
--- a/components/script/page.rs
+++ b/components/script/page.rs
@@ -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,
}
}
}