mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove explicit lifetimes which can be elided.
This commit is contained in:
parent
11d23a41b3
commit
88991013ab
39 changed files with 66 additions and 66 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue