diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-10-16 14:35:30 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-10-16 17:16:20 +0200 |
commit | aa15dc269f41503d81ad44cd7e85d69e6f4aeac7 (patch) | |
tree | 981d8d64c8de6ffd4c9e855553f34b6d09856d88 /components/script/dom/htmlcollection.rs | |
parent | a5100e3c783f140c368da89e25e50581dce91bfd (diff) | |
download | servo-aa15dc269f41503d81ad44cd7e85d69e6f4aeac7.tar.gz servo-aa15dc269f41503d81ad44cd7e85d69e6f4aeac7.zip |
Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.
This is expected since `Box::new` is defined as:
```rust
impl<T> Box<T> {
#[inline(always)]
pub fn new(x: T) -> Box<T> {
box x
}
}
```
With inlining, it should compile to the same as box syntax.
Diffstat (limited to 'components/script/dom/htmlcollection.rs')
-rw-r--r-- | components/script/dom/htmlcollection.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index cefa1407413..19b756769bc 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -82,7 +82,7 @@ impl HTMLCollection { #[allow(unrooted_must_root)] pub fn new(window: &Window, root: &Node, filter: Box<CollectionFilter + 'static>) -> DomRoot<HTMLCollection> { - reflect_dom_object(box HTMLCollection::new_inherited(root, filter), + reflect_dom_object(Box::new(HTMLCollection::new_inherited(root, filter)), window, HTMLCollectionBinding::Wrap) } @@ -126,7 +126,7 @@ impl HTMLCollection { true } } - return HTMLCollection::create(window, root, box AllFilter); + return HTMLCollection::create(window, root, Box::new(AllFilter)); } #[derive(HeapSizeOf, JSTraceable)] @@ -148,7 +148,7 @@ impl HTMLCollection { ascii_lower_qualified_name: qualified_name.to_ascii_lowercase(), qualified_name: qualified_name, }; - HTMLCollection::create(window, root, box filter) + HTMLCollection::create(window, root, Box::new(filter)) } fn match_element(elem: &Element, qualified_name: &LocalName) -> bool { @@ -182,7 +182,7 @@ impl HTMLCollection { let filter = TagNameNSFilter { qname: qname }; - HTMLCollection::create(window, root, box filter) + HTMLCollection::create(window, root, Box::new(filter)) } pub fn by_class_name(window: &Window, root: &Node, classes: DOMString) @@ -208,7 +208,7 @@ impl HTMLCollection { let filter = ClassNameFilter { classes: classes }; - HTMLCollection::create(window, root, box filter) + HTMLCollection::create(window, root, Box::new(filter)) } pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> { @@ -219,7 +219,7 @@ impl HTMLCollection { root.is_parent_of(elem.upcast()) } } - HTMLCollection::create(window, root, box ElementChildFilter) + HTMLCollection::create(window, root, Box::new(ElementChildFilter)) } pub fn elements_iter_after<'a>(&'a self, after: &'a Node) -> impl Iterator<Item=DomRoot<Element>> + 'a { |