diff options
author | Corey Farwell <coreyf@rwell.org> | 2015-08-20 12:56:49 -0400 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2015-08-20 13:18:05 -0400 |
commit | e2c700e6adb6d1595e3ea7e44fdac47ba6d3d957 (patch) | |
tree | 45b600539d3bf6b05b9548e4f66a978ea0b54208 /components/script/dom/htmlcollection.rs | |
parent | d2a8c278eaa159ceacffee767523d4ad0cf83da2 (diff) | |
download | servo-e2c700e6adb6d1595e3ea7e44fdac47ba6d3d957.tar.gz servo-e2c700e6adb6d1595e3ea7e44fdac47ba6d3d957.zip |
Work around uses of #[allow(unrooted_must_root)]
Using this directive could cause rooting errors to be silently ignored,
so we should avoid it as much as possible
Diffstat (limited to 'components/script/dom/htmlcollection.rs')
-rw-r--r-- | components/script/dom/htmlcollection.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 71da0d9c04c..48c082fd2ac 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -176,28 +176,25 @@ impl HTMLCollection { impl<'a> HTMLCollectionMethods for &'a HTMLCollection { // https://dom.spec.whatwg.org/#dom-htmlcollection-length - #[allow(unrooted_must_root)] fn Length(self) -> u32 { - let Collection(ref root, ref filter) = self.collection; - let root = root.root(); + let ref root = self.collection.0.root(); + let ref filter = self.collection.1; HTMLCollection::traverse(root.r()) .filter(|element| filter.filter(element.r(), root.r())) .count() as u32 } // https://dom.spec.whatwg.org/#dom-htmlcollection-item - #[allow(unrooted_must_root)] fn Item(self, index: u32) -> Option<Root<Element>> { let index = index as usize; - let Collection(ref root, ref filter) = self.collection; - let root = root.root(); + let ref root = self.collection.0.root(); + let ref filter = self.collection.1; HTMLCollection::traverse(root.r()) .filter(|element| filter.filter(element.r(), root.r())) .nth(index) } // https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem - #[allow(unrooted_must_root)] fn NamedItem(self, key: DOMString) -> Option<Root<Element>> { // Step 1. if key.is_empty() { @@ -205,8 +202,8 @@ impl<'a> HTMLCollectionMethods for &'a HTMLCollection { } // Step 2. - let Collection(ref root, ref filter) = self.collection; - let root = root.root(); + let ref root = self.collection.0.root(); + let ref filter = self.collection.1; HTMLCollection::traverse(root.r()) .filter(|element| filter.filter(element.r(), root.r())) .find(|elem| { @@ -234,8 +231,8 @@ impl<'a> HTMLCollectionMethods for &'a HTMLCollection { let mut result = vec![]; // Step 2 - let ref filter = self.collection.1; let root = self.collection.0.root(); + let ref filter = self.collection.1; let elems = HTMLCollection::traverse(root.r()).filter(|element| filter.filter(element.r(), root.r())); for elem in elems { // Step 2.1 |