Clean up the cast calls

This commit is contained in:
Anthony Ramine 2015-10-07 14:55:02 +02:00
parent 13ea3ac413
commit 68014af78e
66 changed files with 412 additions and 718 deletions

View file

@ -154,7 +154,7 @@ impl HTMLCollection {
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
root.is_parent_of(elem.upcast::<Node>())
root.is_parent_of(elem.upcast())
}
}
HTMLCollection::create(window, root, box ElementChildFilter)
@ -186,8 +186,8 @@ impl<'a> Iterator for HTMLCollectionElementsIter<'a> {
let filter = self.filter;
let root = self.root.r();
self.node_iter.by_ref()
.filter_map(Root::downcast::<Element>)
.filter(|element| filter.filter(element.r(), root))
.filter_map(Root::downcast)
.filter(|element| filter.filter(&element, root))
.next()
}
}