Auto merge of #8481 - frewsxcv:iterablepage-iter, r=Ms2ger

Simplify IterablePage::find

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8481)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-12 18:29:12 +05:30
commit 743ca24819

View file

@ -43,12 +43,14 @@ impl IterablePage for Rc<Page> {
}
}
fn find(&self, id: PipelineId) -> Option<Rc<Page>> {
if self.id == id { return Some(self.clone()); }
for page in &*self.children.borrow() {
let found = page.find(id);
if found.is_some() { return found; }
if self.id == id {
return Some(self.clone());
}
None
self.children.borrow()
.iter()
.filter_map(|p| p.find(id))
.next()
}
}