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/stylesheet_loader.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/script/stylesheet_loader.rs') diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index e789d32e7b0..3444cb0af02 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -231,9 +231,9 @@ impl<'a> StylesheetLoader<'a> { task_source: document.window().networking_task_source(), canceller: Some(document.window().task_canceller()) }; - ROUTER.add_route(action_receiver.to_opaque(), box move |message| { + ROUTER.add_route(action_receiver.to_opaque(), Box::new(move |message| { listener.notify_fetch(message.to().unwrap()); - }); + })); let owner = self.elem.upcast::().as_stylesheet_owner() -- cgit v1.2.3