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

@ -598,16 +598,16 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}
pub fn pipeline_details<'a>(&'a mut self,
pub fn pipeline_details (&mut self,
pipeline_id: PipelineId)
-> &'a mut PipelineDetails {
-> &mut PipelineDetails {
if !self.pipeline_details.contains_key(&pipeline_id) {
self.pipeline_details.insert(pipeline_id, PipelineDetails::new());
}
return self.pipeline_details.get_mut(&pipeline_id).unwrap();
}
pub fn pipeline<'a>(&'a self, pipeline_id: PipelineId) -> Option<&'a CompositionPipeline> {
pub fn pipeline(&self, pipeline_id: PipelineId) -> Option<&CompositionPipeline> {
match self.pipeline_details.get(&pipeline_id) {
Some(ref details) => details.pipeline.as_ref(),
None => panic!("Compositor layer has an unknown pipeline ({:?}).", pipeline_id),

View file

@ -381,10 +381,10 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
#[inline(always)]
#[allow(unsafe_code)]
pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow {
pub fn base<T: ?Sized + Flow>(this: &T) -> &BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this);
mem::transmute::<*mut (), &'a BaseFlow>(obj.data)
let obj = mem::transmute::<&&T, &raw::TraitObject>(&this);
mem::transmute::<*mut (), &BaseFlow>(obj.data)
}
}
@ -395,10 +395,10 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
#[inline(always)]
#[allow(unsafe_code)]
pub fn mut_base<'a, T: ?Sized + Flow>(this: &'a mut T) -> &'a mut BaseFlow {
pub fn mut_base<T: ?Sized + Flow>(this: &mut T) -> &mut BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a mut T, &'a raw::TraitObject>(&this);
mem::transmute::<*mut (), &'a mut BaseFlow>(obj.data)
let obj = mem::transmute::<&&mut T, &raw::TraitObject>(&this);
mem::transmute::<*mut (), &mut BaseFlow>(obj.data)
}
}

View file

@ -24,27 +24,27 @@ pub struct MutFlowListIterator<'a> {
impl FlowList {
/// Provide a reference to the front element, or None if the list is empty
#[inline]
pub fn front<'a>(&'a self) -> Option<&'a Flow> {
pub fn front(&self) -> Option<&Flow> {
self.flows.front().map(|head| &**head)
}
/// Provide a mutable reference to the front element, or None if the list is empty
#[inline]
#[allow(unsafe_code)]
pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
pub unsafe fn front_mut(&mut self) -> Option<&mut Flow> {
self.flows.front_mut().map(flow_ref::deref_mut)
}
/// Provide a reference to the back element, or None if the list is empty
#[inline]
pub fn back<'a>(&'a self) -> Option<&'a Flow> {
pub fn back(&self) -> Option<&Flow> {
self.flows.back().map(|tail| &**tail)
}
/// Provide a mutable reference to the back element, or None if the list is empty
#[inline]
#[allow(unsafe_code)]
pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
pub unsafe fn back_mut(&mut self) -> Option<&mut Flow> {
self.flows.back_mut().map(flow_ref::deref_mut)
}

View file

@ -20,7 +20,7 @@ pub type WeakFlowRef = Weak<Flow>;
/// See https://github.com/servo/servo/issues/6503
/// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created).
#[allow(unsafe_code)]
pub fn deref_mut<'a>(r: &'a mut FlowRef) -> &'a mut Flow {
pub fn deref_mut<'a>(r: &mut FlowRef) -> &'a mut Flow {
let ptr: *const Flow = &**r;
unsafe {
&mut *(ptr as *mut Flow)

View file

@ -2387,7 +2387,7 @@ impl Fragment {
}
}
pub fn inline_styles<'a>(&'a self) -> InlineStyleIterator<'a> {
pub fn inline_styles(&self) -> InlineStyleIterator {
InlineStyleIterator::new(self)
}
@ -2542,7 +2542,7 @@ impl<'a> Iterator for InlineStyleIterator<'a> {
}
impl<'a> InlineStyleIterator<'a> {
fn new<'b>(fragment: &'b Fragment) -> InlineStyleIterator<'b> {
fn new(fragment: &Fragment) -> InlineStyleIterator {
InlineStyleIterator {
fragment: fragment,
inline_style_index: 0,

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)
}

View file

@ -38,7 +38,7 @@ pub enum ViewportDescriptor {
}
trait FromMeta: Sized {
fn from_meta<'a>(value: &'a str) -> Option<Self>;
fn from_meta (value: &str) -> Option<Self>;
}
// ViewportLength is a length | percentage | auto | extend-to-zoom
@ -63,7 +63,7 @@ impl ToCss for ViewportLength {
}
impl FromMeta for ViewportLength {
fn from_meta<'a>(value: &'a str) -> Option<ViewportLength> {
fn from_meta(value: &str) -> Option<ViewportLength> {
macro_rules! specified {
($value:expr) => {
ViewportLength::Specified(LengthOrPercentageOrAuto::Length($value))
@ -276,7 +276,7 @@ impl ViewportRule {
Ok(ViewportRule { declarations: valid_declarations.iter().cascade() })
}
pub fn from_meta<'a>(content: &'a str) -> Option<ViewportRule> {
pub fn from_meta(content: &str) -> Option<ViewportRule> {
let mut declarations = HashMap::new();
macro_rules! push_descriptor {
($descriptor:ident($value:expr)) => {{