Remove explicit lifetimes which can be elided.

This commit is contained in:
Adam Szopa 2015-10-21 01:00:58 +02:00
parent 11d23a41b3
commit 88991013ab
39 changed files with 66 additions and 66 deletions

View file

@ -65,7 +65,7 @@ impl<'a> GlobalRef<'a> {
/// Extract a `Window`, causing task failure if the global object is not
/// a `Window`.
pub fn as_window<'b>(&'b self) -> &'b window::Window {
pub fn as_window(&self) -> &window::Window {
match *self {
GlobalRef::Window(window) => window,
GlobalRef::Worker(_) => panic!("expected a Window scope"),
@ -189,7 +189,7 @@ impl<'a> GlobalRef<'a> {
}
impl<'a> Reflectable for GlobalRef<'a> {
fn reflector<'b>(&'b self) -> &'b Reflector {
fn reflector(&self) -> &Reflector {
match *self {
GlobalRef::Window(ref window) => window.reflector(),
GlobalRef::Worker(ref worker) => worker.reflector(),

View file

@ -260,12 +260,12 @@ impl Document {
}
// https://dom.spec.whatwg.org/#concept-document-url
pub fn url<'a>(&'a self) -> &'a Url {
pub fn url(&self) -> &Url {
&self.url
}
// https://html.spec.whatwg.org/multipage/#fallback-base-url
pub fn fallback_base_url<'a>(&'a self) -> Url {
pub fn fallback_base_url(&self) -> Url {
// Step 1: iframe srcdoc (#4767).
// Step 2: about:blank with a creator browsing context.
// Step 3.

View file

@ -1507,7 +1507,7 @@ impl ElementMethods for Element {
}
impl VirtualMethods for Element {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let node: &Node = NodeCast::from_ref(self);
Some(node as &VirtualMethods)
}
@ -1664,10 +1664,10 @@ impl<'a> ::selectors::Element for Root<Element> {
false
}
fn get_local_name<'b>(&'b self) -> &'b Atom {
fn get_local_name(&self) -> &Atom {
self.local_name()
}
fn get_namespace<'b>(&'b self) -> &'b Namespace {
fn get_namespace(&self) -> &Namespace {
self.namespace()
}
@ -1768,16 +1768,16 @@ impl<'a> ::selectors::Element for Root<Element> {
impl Element {
pub fn as_maybe_activatable<'a>(&'a self) -> Option<&'a (Activatable + 'a)> {
pub fn as_maybe_activatable(&self) -> Option<&Activatable> {
let node = NodeCast::from_ref(self);
let element = match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
let element = HTMLInputElementCast::to_ref(self).unwrap();
Some(element as &'a (Activatable + 'a))
Some(element as &Activatable)
},
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
let element = HTMLAnchorElementCast::to_ref(self).unwrap();
Some(element as &'a (Activatable + 'a))
Some(element as &Activatable)
},
_ => {
None
@ -1826,7 +1826,7 @@ impl Element {
///
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
/// If the spec says otherwise, check with Manishearth first
pub fn authentic_click_activation<'b>(&self, event: &'b Event) {
pub fn authentic_click_activation(&self, event: &Event) {
// Not explicitly part of the spec, however this helps enforce the invariants
// required to save state between pre-activation and post-activation
// since we cannot nest authentic clicks (unlike synthetic click activation, where

View file

@ -318,7 +318,7 @@ impl EventTargetMethods for EventTarget {
}
impl VirtualMethods for EventTarget {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
None
}
}

View file

@ -54,7 +54,7 @@ impl HTMLAnchorElement {
}
impl VirtualMethods for HTMLAnchorElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}
@ -113,7 +113,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
}
impl Activatable for HTMLAnchorElement {
fn as_element<'b>(&'b self) -> &'b Element {
fn as_element(&self) -> &Element {
ElementCast::from_ref(self)
}

View file

@ -47,7 +47,7 @@ impl HTMLAppletElementMethods for HTMLAppletElement {
}
impl VirtualMethods for HTMLAppletElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
}

View file

@ -41,7 +41,7 @@ impl HTMLAreaElement {
}
impl VirtualMethods for HTMLAreaElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -60,7 +60,7 @@ impl HTMLBaseElement {
}
impl VirtualMethods for HTMLBaseElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
}

View file

@ -122,7 +122,7 @@ impl HTMLBodyElement {
}
impl VirtualMethods for HTMLBodyElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let element: &HTMLElement = HTMLElementCast::from_ref(self);
Some(element as &VirtualMethods)
}

View file

@ -134,7 +134,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
}
impl VirtualMethods for HTMLButtonElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}
@ -188,7 +188,7 @@ impl VirtualMethods for HTMLButtonElement {
impl FormControl for HTMLButtonElement {}
impl<'a> Activatable for &'a HTMLButtonElement {
fn as_element<'b>(&'b self) -> &'b Element {
fn as_element(&self) -> &Element {
ElementCast::from_ref(*self)
}

View file

@ -263,7 +263,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
}
impl VirtualMethods for HTMLCanvasElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let element: &HTMLElement = HTMLElementCast::from_ref(self);
Some(element as &VirtualMethods)
}

View file

@ -305,7 +305,7 @@ impl HTMLElement {
}
impl VirtualMethods for HTMLElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let element: &Element = ElementCast::from_ref(self);
Some(element as &VirtualMethods)
}

View file

@ -81,7 +81,7 @@ impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
}
impl VirtualMethods for HTMLFieldSetElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -70,7 +70,7 @@ impl HTMLFontElementMethods for HTMLFontElement {
}
impl VirtualMethods for HTMLFontElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -218,7 +218,7 @@ impl HTMLFormElement {
win.r().pipeline(), load_data)).unwrap();
}
fn get_unclean_dataset<'a>(&self, submitter: Option<FormSubmitter<'a>>) -> Vec<FormDatum> {
fn get_unclean_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
let node = NodeCast::from_ref(self);
// TODO: This is an incorrect way of getting controls owned
// by the form, but good enough until html5ever lands
@ -256,7 +256,7 @@ impl HTMLFormElement {
// https://html.spec.whatwg.org/multipage/#the-directionality
}
pub fn get_form_dataset<'a>(&self, submitter: Option<FormSubmitter<'a>>) -> Vec<FormDatum> {
pub fn get_form_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
fn clean_crlf(s: &str) -> DOMString {
// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
// Step 4
@ -515,7 +515,7 @@ pub trait FormControl: ElementBase + Reflectable {
}
impl VirtualMethods for HTMLFormElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
}

View file

@ -36,7 +36,7 @@ impl HTMLHeadElement {
}
impl VirtualMethods for HTMLHeadElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -359,7 +359,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
}
impl VirtualMethods for HTMLIFrameElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -298,7 +298,7 @@ impl HTMLImageElementMethods for HTMLImageElement {
}
impl VirtualMethods for HTMLImageElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -399,7 +399,7 @@ impl HTMLInputElement {
}
}
pub fn get_form_datum<'a>(&self, submitter: Option<FormSubmitter<'a>>) -> Option<FormDatum> {
pub fn get_form_datum(&self, submitter: Option<FormSubmitter>) -> Option<FormDatum> {
let ty = self.Type();
let name = self.Name();
let is_submitter = match submitter {
@ -491,7 +491,7 @@ impl HTMLInputElement {
}
impl VirtualMethods for HTMLInputElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}
@ -662,7 +662,7 @@ impl VirtualMethods for HTMLInputElement {
impl FormControl for HTMLInputElement {}
impl Activatable for HTMLInputElement {
fn as_element<'b>(&'b self) -> &'b Element {
fn as_element(&self) -> &Element {
ElementCast::from_ref(self)
}

View file

@ -88,7 +88,7 @@ fn is_favicon(value: &Option<String>) -> bool {
}
impl VirtualMethods for HTMLLinkElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -82,7 +82,7 @@ impl HTMLMetaElementMethods for HTMLMetaElement {
}
impl VirtualMethods for HTMLMetaElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -91,7 +91,7 @@ impl HTMLObjectElementMethods for HTMLObjectElement {
}
impl VirtualMethods for HTMLObjectElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -49,7 +49,7 @@ impl HTMLOptGroupElementMethods for HTMLOptGroupElement {
}
impl VirtualMethods for HTMLOptGroupElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -142,7 +142,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
}
impl VirtualMethods for HTMLOptionElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -514,7 +514,7 @@ impl HTMLScriptElement {
}
impl VirtualMethods for HTMLScriptElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -99,7 +99,7 @@ impl HTMLSelectElementMethods for HTMLSelectElement {
}
impl VirtualMethods for HTMLSelectElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -63,7 +63,7 @@ impl HTMLStyleElement {
}
impl VirtualMethods for HTMLStyleElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -98,7 +98,7 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
}
impl VirtualMethods for HTMLTableCellElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -143,7 +143,7 @@ impl HTMLTableElement {
}
impl VirtualMethods for HTMLTableElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -96,7 +96,7 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
}
impl VirtualMethods for HTMLTableRowElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -81,7 +81,7 @@ impl HTMLTableSectionElementMethods for HTMLTableSectionElement {
}
impl VirtualMethods for HTMLTableSectionElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -236,7 +236,7 @@ impl HTMLTextAreaElement {
}
impl VirtualMethods for HTMLTextAreaElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}

View file

@ -59,7 +59,7 @@ impl HTMLTitleElementMethods for HTMLTitleElement {
}
impl VirtualMethods for HTMLTitleElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
fn super_type(&self) -> Option<&VirtualMethods> {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
}