From 2aa1554b0c36bce1b25028c6f2a0dfbf9abefeb0 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Fri, 6 Jun 2014 23:17:50 +0900 Subject: Remove needless '&self mut' from VirtualMethods trait. --- src/components/script/dom/virtualmethods.rs | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/components/script/dom/virtualmethods.rs') diff --git a/src/components/script/dom/virtualmethods.rs b/src/components/script/dom/virtualmethods.rs index 29567bb9463..aafe3efe4f4 100644 --- a/src/components/script/dom/virtualmethods.rs +++ b/src/components/script/dom/virtualmethods.rs @@ -30,52 +30,52 @@ use servo_util::str::DOMString; pub trait VirtualMethods { /// Returns self as the superclass of the implementation for this trait, /// if any. - fn super_type<'a>(&'a mut self) -> Option<&'a mut VirtualMethods:>; + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:>; /// Called when changing or adding attributes, after the attribute's value /// has been updated. - fn after_set_attr(&mut self, name: DOMString, value: DOMString) { + fn after_set_attr(&self, name: DOMString, value: DOMString) { match self.super_type() { - Some(ref mut s) => s.after_set_attr(name, value), + Some(ref s) => s.after_set_attr(name, value), _ => (), } } /// Called when changing or removing attributes, before any modification /// has taken place. - fn before_remove_attr(&mut self, name: DOMString, value: DOMString) { + fn before_remove_attr(&self, name: DOMString, value: DOMString) { match self.super_type() { - Some(ref mut s) => s.before_remove_attr(name, value), + Some(ref s) => s.before_remove_attr(name, value), _ => (), } } /// Called when a Node is appended to a tree that is part of a Document. - fn bind_to_tree(&mut self) { + fn bind_to_tree(&self) { match self.super_type() { - Some(ref mut s) => s.bind_to_tree(), + Some(ref s) => s.bind_to_tree(), _ => (), } } /// Called when a Node is removed from a tree that is part of a Document. - fn unbind_from_tree(&mut self) { + fn unbind_from_tree(&self) { match self.super_type() { - Some(ref mut s) => s.unbind_from_tree(), + Some(ref s) => s.unbind_from_tree(), _ => (), } } /// Called on the parent when a node is added to its child list. - fn child_inserted(&mut self, child: &JSRef) { + fn child_inserted(&self, child: &JSRef) { match self.super_type() { - Some(ref mut s) => s.child_inserted(child), + Some(ref s) => s.child_inserted(child), _ => (), } } /// Called during event dispatch after the bubbling phase completes. - fn handle_event(&mut self, event: &JSRef) { + fn handle_event(&self, event: &JSRef) { match self.super_type() { Some(s) => { s.handle_event(event); @@ -89,42 +89,42 @@ pub trait VirtualMethods { /// method call on the trait object will invoke the corresponding method on the /// concrete type, propagating up the parent hierarchy unless otherwise /// interrupted. -pub fn vtable_for<'a>(node: &'a mut JSRef) -> &'a mut VirtualMethods: { +pub fn vtable_for<'a>(node: &'a JSRef) -> &'a VirtualMethods: { match node.type_id() { ElementNodeTypeId(HTMLAnchorElementTypeId) => { - let element: &mut JSRef = HTMLAnchorElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLAnchorElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(HTMLBodyElementTypeId) => { - let element: &mut JSRef = HTMLBodyElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLBodyElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(HTMLImageElementTypeId) => { - let element: &mut JSRef = HTMLImageElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLImageElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(HTMLIFrameElementTypeId) => { - let element: &mut JSRef = HTMLIFrameElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLIFrameElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(HTMLObjectElementTypeId) => { - let element: &mut JSRef = HTMLObjectElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLObjectElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(HTMLStyleElementTypeId) => { - let element: &mut JSRef = HTMLStyleElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLStyleElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(ElementTypeId) => { - let element: &mut JSRef = ElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = ElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } ElementNodeTypeId(_) => { - let element: &mut JSRef = HTMLElementCast::to_mut_ref(node).unwrap(); - element as &mut VirtualMethods: + let element: &JSRef = HTMLElementCast::to_ref(node).unwrap(); + element as &VirtualMethods: } _ => { - node as &mut VirtualMethods: + node as &VirtualMethods: } } } -- cgit v1.2.3