mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Simplify IterablePage::find
This commit is contained in:
parent
1b20bc90ee
commit
94f0478f51
1 changed files with 7 additions and 5 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue