diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2015-09-04 08:55:51 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-09-04 08:55:51 +0530 |
commit | 54c036cd66f6c9a59610fb804d57a63ab7aad19f (patch) | |
tree | 08d14c8c8e0ed17ca9da314e22b9ac32d73aaf00 /components/script | |
parent | 35dd1816a9ea90484ae91ecce3a3e7eb094227c1 (diff) | |
download | servo-54c036cd66f6c9a59610fb804d57a63ab7aad19f.tar.gz servo-54c036cd66f6c9a59610fb804d57a63ab7aad19f.zip |
Elide most 'a lifetimes
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/activation.rs | 2 | ||||
-rw-r--r-- | components/script/dom/attr.rs | 12 | ||||
-rw-r--r-- | components/script/dom/bindings/cell.rs | 14 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 14 | ||||
-rw-r--r-- | components/script/dom/bindings/str.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/utils.rs | 2 | ||||
-rw-r--r-- | components/script/dom/characterdata.rs | 4 | ||||
-rw-r--r-- | components/script/dom/documenttype.rs | 6 | ||||
-rw-r--r-- | components/script/dom/element.rs | 8 | ||||
-rw-r--r-- | components/script/dom/event.rs | 2 | ||||
-rw-r--r-- | components/script/dom/eventdispatcher.rs | 2 | ||||
-rw-r--r-- | components/script/dom/eventtarget.rs | 2 | ||||
-rw-r--r-- | components/script/dom/file.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 2 |
15 files changed, 38 insertions, 38 deletions
diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs index 441871f9abe..d14861ed686 100644 --- a/components/script/dom/activation.rs +++ b/components/script/dom/activation.rs @@ -14,7 +14,7 @@ use std::borrow::ToOwned; /// Trait for elements with defined activation behavior pub trait Activatable { - fn as_element<'a>(&'a self) -> &'a Element; + fn as_element(&self) -> ∈ // Is this particular instance of the element activatable? fn is_instance_activatable(&self) -> bool; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 4c5f2c09d80..32178148ccf 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -75,14 +75,14 @@ impl AttrValue { AttrValue::Atom(value) } - pub fn as_tokens<'a>(&'a self) -> &'a [Atom] { + pub fn as_tokens(&self) -> &[Atom] { match *self { AttrValue::TokenList(_, ref tokens) => tokens, _ => panic!("Tokens not found"), } } - pub fn as_atom<'a>(&'a self) -> &'a Atom { + pub fn as_atom(&self) -> &Atom { match *self { AttrValue::Atom(ref value) => value, _ => panic!("Atom not found"), @@ -104,7 +104,7 @@ impl AttrValue { impl Deref for AttrValue { type Target = str; - fn deref<'a>(&'a self) -> &'a str { + fn deref(&self) -> &str { match *self { AttrValue::String(ref value) | AttrValue::TokenList(ref value, _) | @@ -152,17 +152,17 @@ impl Attr { } #[inline] - pub fn name<'a>(&'a self) -> &'a Atom { + pub fn name(&self) -> &Atom { &self.name } #[inline] - pub fn namespace<'a>(&'a self) -> &'a Namespace { + pub fn namespace(&self) -> &Namespace { &self.namespace } #[inline] - pub fn prefix<'a>(&'a self) -> &'a Option<Atom> { + pub fn prefix(&self) -> &Option<Atom> { &self.prefix } } diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 80bab8839bc..e2cbe4bfef5 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -29,7 +29,7 @@ impl<T> DOMRefCell<T> { /// /// For use in the layout task only. #[allow(unsafe_code)] - pub unsafe fn borrow_for_layout<'a>(&'a self) -> &'a T { + pub unsafe fn borrow_for_layout(&self) -> &T { debug_assert!(task_state::get().is_layout()); &*self.value.as_unsafe_cell().get() } @@ -39,7 +39,7 @@ impl<T> DOMRefCell<T> { /// This succeeds even if the object is mutably borrowed, /// so you have to be careful in trace code! #[allow(unsafe_code)] - pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T { + pub unsafe fn borrow_for_gc_trace(&self) -> &T { // FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs // https://github.com/servo/servo/issues/6389 //debug_assert!(task_state::get().contains(SCRIPT | IN_GC)); @@ -49,7 +49,7 @@ impl<T> DOMRefCell<T> { /// Borrow the contents for the purpose of script deallocation. /// #[allow(unsafe_code)] - pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T { + pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T { debug_assert!(task_state::get().contains(SCRIPT)); &mut *self.value.as_unsafe_cell().get() } @@ -71,7 +71,7 @@ impl<T> DOMRefCell<T> { /// # Panics /// /// Panics if this is called off the script thread. - pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> { + pub fn try_borrow(&self) -> Option<Ref<T>> { debug_assert!(task_state::get().is_script()); match self.value.borrow_state() { BorrowState::Writing => None, @@ -89,7 +89,7 @@ impl<T> DOMRefCell<T> { /// # Panics /// /// Panics if this is called off the script thread. - pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> { + pub fn try_borrow_mut(&self) -> Option<RefMut<T>> { debug_assert!(task_state::get().is_script()); match self.value.borrow_state() { BorrowState::Unused => Some(self.value.borrow_mut()), @@ -127,7 +127,7 @@ impl<T> DOMRefCell<T> { /// Panics if this is called off the script thread. /// /// Panics if the value is currently mutably borrowed. - pub fn borrow<'a>(&'a self) -> Ref<'a, T> { + pub fn borrow(&self) -> Ref<T> { self.try_borrow().expect("DOMRefCell<T> already mutably borrowed") } @@ -141,7 +141,7 @@ impl<T> DOMRefCell<T> { /// Panics if this is called off the script thread. /// /// Panics if the value is currently borrowed. - pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { + pub fn borrow_mut(&self) -> RefMut<T> { self.try_borrow_mut().expect("DOMRefCell<T> already borrowed") } } diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index feb3a67d51f..5345d08ee9e 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -149,7 +149,7 @@ impl LayoutJS<Node> { } impl<T: Reflectable> Reflectable for JS<T> { - fn reflector<'a>(&'a self) -> &'a Reflector { + fn reflector(&self) -> &Reflector { unsafe { (**self.ptr).reflector() } @@ -310,11 +310,11 @@ impl<T: Reflectable> LayoutJS<T> { pub trait RootedReference<T> { /// Obtain a safe optional reference to the wrapped JS owned-value that /// cannot outlive the lifetime of this root. - fn r<'a>(&'a self) -> Option<&'a T>; + fn r(&self) -> Option<&T>; } impl<T: Reflectable> RootedReference<T> for Option<Root<T>> { - fn r<'a>(&'a self) -> Option<&'a T> { + fn r(&self) -> Option<&T> { self.as_ref().map(|root| root.r()) } } @@ -323,11 +323,11 @@ impl<T: Reflectable> RootedReference<T> for Option<Root<T>> { pub trait OptionalRootedReference<T> { /// Obtain a safe optional optional reference to the wrapped JS owned-value /// that cannot outlive the lifetime of this root. - fn r<'a>(&'a self) -> Option<Option<&'a T>>; + fn r(&self) -> Option<Option<&T>>; } impl<T: Reflectable> OptionalRootedReference<T> for Option<Option<Root<T>>> { - fn r<'a>(&'a self) -> Option<Option<&'a T>> { + fn r(&self) -> Option<Option<&T>> { self.as_ref().map(|inner| inner.r()) } } @@ -430,7 +430,7 @@ impl<T: Reflectable> Root<T> { /// Obtain a safe reference to the wrapped JS owned-value that cannot /// outlive the lifetime of this root. - pub fn r<'a>(&'a self) -> &'a T { + pub fn r(&self) -> &T { &**self } @@ -443,7 +443,7 @@ impl<T: Reflectable> Root<T> { impl<T: Reflectable> Deref for Root<T> { type Target = T; - fn deref<'a>(&'a self) -> &'a T { + fn deref(&self) -> &T { unsafe { &**self.ptr.deref() } } } diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 6c7fea1dc10..ee6514bffbd 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -25,7 +25,7 @@ impl ByteString { /// Returns `self` as a string, if it encodes valid UTF-8, and `None` /// otherwise. - pub fn as_str<'a>(&'a self) -> Option<&'a str> { + pub fn as_str(&self) -> Option<&str> { let ByteString(ref vec) = *self; str::from_utf8(&vec).ok() } diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index d7912ae9af4..7e4d8645f96 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -404,7 +404,7 @@ pub fn initialize_global(global: *mut JSObject) { /// A trait to provide access to the `Reflector` for a DOM object. pub trait Reflectable { /// Returns the receiver's reflector. - fn reflector<'a>(&'a self) -> &'a Reflector; + fn reflector(&self) -> &Reflector; /// Initializes the Reflector fn init_reflector(&mut self, _obj: *mut JSObject) { panic!("Cannot call init on this Reflectable"); diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index d9c558ee2e8..3efcd7c16c2 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -179,13 +179,13 @@ impl CharacterData { #[allow(unsafe_code)] pub trait LayoutCharacterDataHelpers { - unsafe fn data_for_layout<'a>(&'a self) -> &'a str; + unsafe fn data_for_layout(&self) -> &str; } #[allow(unsafe_code)] impl LayoutCharacterDataHelpers for LayoutJS<CharacterData> { #[inline] - unsafe fn data_for_layout<'a>(&'a self) -> &'a str { + unsafe fn data_for_layout(&self) -> &str { &(*self.unsafe_get()).data.borrow_for_layout() } } diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index 265c918b466..0d91cdedb1a 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -58,17 +58,17 @@ impl DocumentType { } #[inline] - pub fn name<'a>(&'a self) -> &'a DOMString { + pub fn name(&self) -> &DOMString { &self.name } #[inline] - pub fn public_id<'a>(&'a self) -> &'a DOMString { + pub fn public_id(&self) -> &DOMString { &self.public_id } #[inline] - pub fn system_id<'a>(&'a self) -> &'a DOMString { + pub fn system_id(&self) -> &DOMString { &self.system_id } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index f9d3920cfd3..3d79189a07e 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -494,8 +494,8 @@ pub trait LayoutElementHelpers { #[allow(unsafe_code)] unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool; fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>; - fn local_name<'a>(&'a self) -> &'a Atom; - fn namespace<'a>(&'a self) -> &'a Namespace; + fn local_name(&self) -> &Atom; + fn namespace(&self) -> &Namespace; fn get_checked_state_for_layout(&self) -> bool; fn get_indeterminate_state_for_layout(&self) -> bool; } @@ -524,14 +524,14 @@ impl LayoutElementHelpers for LayoutJS<Element> { } #[allow(unsafe_code)] - fn local_name<'a>(&'a self) -> &'a Atom { + fn local_name(&self) -> &Atom { unsafe { &(*self.unsafe_get()).local_name } } #[allow(unsafe_code)] - fn namespace<'a>(&'a self) -> &'a Namespace { + fn namespace(&self) -> &Namespace { unsafe { &(*self.unsafe_get()).namespace } diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 58b45932cd8..d45407a51fe 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -117,7 +117,7 @@ impl Event { } #[inline] - pub fn type_id<'a>(&'a self) -> &'a EventTypeId { + pub fn type_id(&self) -> &EventTypeId { &self.type_id } diff --git a/components/script/dom/eventdispatcher.rs b/components/script/dom/eventdispatcher.rs index 024ba6a1350..7c5d06ab807 100644 --- a/components/script/dom/eventdispatcher.rs +++ b/components/script/dom/eventdispatcher.rs @@ -13,7 +13,7 @@ use dom::node::Node; use dom::virtualmethods::vtable_for; // See https://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm -pub fn dispatch_event<'a, 'b>(target: &'a EventTarget, +pub fn dispatch_event<'b>(target: &EventTarget, pseudo_target: Option<&'b EventTarget>, event: &Event) -> bool { assert!(!event.dispatching()); diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 704ea280613..f2f228f2c0d 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -160,7 +160,7 @@ impl EventTarget { } #[inline] - pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId { + pub fn type_id(&self) -> &EventTargetTypeId { &self.type_id } diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 8da50b26b13..f6b48927409 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -34,7 +34,7 @@ impl File { FileBinding::Wrap) } - pub fn name<'a>(&'a self) -> &'a DOMString { + pub fn name(&self) -> &DOMString { &self.name } } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 33a4a45d295..7aa1c13acf4 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -356,7 +356,7 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&str>) do_broadcast(doc_node, broadcaster, owner.r(), group) } -fn in_same_group<'a,'b>(other: &'a HTMLInputElement, +fn in_same_group<'b>(other: &HTMLInputElement, owner: Option<&'b HTMLFormElement>, group: Option<&str>) -> bool { let other_owner = other.form_owner(); diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index bef4dcd93e0..4b40e13e129 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -36,7 +36,7 @@ impl HTMLMediaElement { } #[inline] - pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement { + pub fn htmlelement(&self) -> &HTMLElement { &self.htmlelement } } |