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/mutationrecord.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/mutationrecord.rs')
-rw-r--r-- | components/script/dom/mutationrecord.rs | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index a3b38182147..dff1a7c0b85 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -32,12 +32,14 @@ impl MutationRecord { attribute_name: &LocalName, attribute_namespace: Option<&Namespace>, old_value: Option<DOMString>) -> DomRoot<MutationRecord> { - let record = box MutationRecord::new_inherited("attributes", - target, - Some(DOMString::from(&**attribute_name)), - attribute_namespace.map(|n| DOMString::from(&**n)), - old_value, - None, None, None, None); + let record = Box::new(MutationRecord::new_inherited( + "attributes", + target, + Some(DOMString::from(&**attribute_name)), + attribute_namespace.map(|n| DOMString::from(&**n)), + old_value, + None, None, None, None + )); reflect_dom_object(record, &*window_from_node(target), MutationRecordBinding::Wrap) } @@ -50,15 +52,19 @@ impl MutationRecord { let added_nodes = added_nodes.map(|list| NodeList::new_simple_list_slice(&window, list)); let removed_nodes = removed_nodes.map(|list| NodeList::new_simple_list_slice(&window, list)); - reflect_dom_object(box MutationRecord::new_inherited("childList", - target, - None, None, None, - added_nodes.as_ref().map(|list| &**list), - removed_nodes.as_ref().map(|list| &**list), - next_sibling, - prev_sibling), - &*window, - MutationRecordBinding::Wrap) + reflect_dom_object( + Box::new(MutationRecord::new_inherited( + "childList", + target, + None, None, None, + added_nodes.as_ref().map(|list| &**list), + removed_nodes.as_ref().map(|list| &**list), + next_sibling, + prev_sibling + )), + &*window, + MutationRecordBinding::Wrap + ) } fn new_inherited(record_type: &str, |