Stop calling deref() and deref_mut() explicitly.

This commit is contained in:
Ms2ger 2015-01-22 14:49:14 +01:00
parent ee4c56bd8b
commit 13c7cf928a
14 changed files with 56 additions and 57 deletions

View file

@ -634,7 +634,7 @@ impl<'a, T: Reflectable> JSRef<'a, T> {
impl<'a, T: Reflectable> Reflectable for JSRef<'a, T> {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.deref().reflector()
(**self).reflector()
}
}

View file

@ -505,7 +505,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
fn update_inline_style(self, property_decl: style::PropertyDeclaration, style_priority: StylePriority) {
let mut inline_declarations = self.style_attribute().borrow_mut();
if let Some(ref mut declarations) = *inline_declarations.deref_mut() {
if let &Some(ref mut declarations) = &mut *inline_declarations {
let existing_declarations = if style_priority == StylePriority::Important {
declarations.important.make_unique()
} else {

View file

@ -515,7 +515,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
fn is_in_doc(self) -> bool {
self.deref().flags.get().contains(IS_IN_DOC)
self.flags.get().contains(IS_IN_DOC)
}
/// Returns the type ID of this node. Fails if this node is borrowed mutably.
@ -728,7 +728,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
fn to_trusted_node_address(self) -> TrustedNodeAddress {
TrustedNodeAddress(self.deref() as *const Node as *const libc::c_void)
TrustedNodeAddress(&*self as *const Node as *const libc::c_void)
}
fn get_bounding_content_box(self) -> Rect<Au> {
@ -1019,7 +1019,7 @@ pub struct NodeChildrenIterator<'a> {
impl<'a> Iterator<JSRef<'a, Node>> for NodeChildrenIterator<'a> {
fn next(&mut self) -> Option<JSRef<'a, Node>> {
let node = self.current;
self.current = node.and_then(|node| node.next_sibling().map(|node| *node.root().deref()));
self.current = node.and_then(|node| node.next_sibling().map(|node| *node.root()));
node
}
}
@ -1043,7 +1043,7 @@ pub struct AncestorIterator<'a> {
impl<'a> Iterator<JSRef<'a, Node>> for AncestorIterator<'a> {
fn next(&mut self) -> Option<JSRef<'a, Node>> {
let node = self.current;
self.current = node.and_then(|node| node.parent_node().map(|node| *node.root().deref()));
self.current = node.and_then(|node| node.parent_node().map(|node| *node.root()));
node
}
}