diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2015-10-15 12:41:13 -0700 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2015-10-15 14:03:58 -0700 |
commit | 9de42c893541aa87c563ab534e0c5209cca251fd (patch) | |
tree | 1bd65c45f4e105dcac731375b74e04869f141e32 | |
parent | 571386777898c2f3513362110aa1ae438aa86e6b (diff) | |
download | servo-9de42c893541aa87c563ab534e0c5209cca251fd.tar.gz servo-9de42c893541aa87c563ab534e0c5209cca251fd.zip |
Simplify extracting a reference from an Option<Root<T>>, per review comments.
-rw-r--r-- | components/script/dom/document.rs | 2 | ||||
-rw-r--r-- | components/script/dom/nodelist.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index b849280e685..175cc68ea9d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -297,7 +297,7 @@ impl Document { .filter_map(HTMLBaseElementCast::to_root) .filter(|element| ElementCast::from_ref(&**element).has_attribute(&atom!("href"))) .next(); - self.base_element.set(base.as_ref().map(Root::r)); + self.base_element.set(base.r()); } pub fn quirks_mode(&self) -> QuirksMode { diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 4510624b4c4..b5db05945ca 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{JS, MutNullableHeap, Root}; +use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::node::{ChildrenMutation, Node}; use dom::window::Window; @@ -103,7 +103,7 @@ impl ChildrenList { let last_visited = node.GetFirstChild(); ChildrenList { node: JS::from_ref(node), - last_visited: MutNullableHeap::new(last_visited.as_ref().map(Root::r)), + last_visited: MutNullableHeap::new(last_visited.r()), last_index: Cell::new(0u32), } } |