From aa15dc269f41503d81ad44cd7e85d69e6f4aeac7 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 16 Oct 2017 14:35:30 +0200 Subject: 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 Box { #[inline(always)] pub fn new(x: T) -> Box { box x } } ``` With inlining, it should compile to the same as box syntax. --- components/script/dom/bindings/iterable.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/script/dom/bindings/iterable.rs') diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index fbb9894210e..33d4e3339cb 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -62,12 +62,12 @@ impl IterableIterator { type_: IteratorType, wrap: unsafe fn(*mut JSContext, &GlobalScope, Box>) -> DomRoot) -> DomRoot { - let iterator = box IterableIterator { + let iterator = Box::new(IterableIterator { reflector: Reflector::new(), type_: type_, iterable: Dom::from_ref(iterable), index: Cell::new(0), - }; + }); reflect_dom_object(iterator, &*iterable.global(), wrap) } -- cgit v1.2.3