Use lifetime elision
This commit is contained in:
parent
791003ad3c
commit
dfc314d19b
3 changed files with 10 additions and 10 deletions
|
|
@ -67,7 +67,7 @@ pub trait AttrMetaMethods {
|
|||
/// containing a string, otherwise None.
|
||||
fn value_str(&self) -> Option<InternedString>;
|
||||
/// Gets a list of inner meta items from a list MetaItem type.
|
||||
fn meta_item_list<'a>(&'a self) -> Option<&'a [P<MetaItem>]>;
|
||||
fn meta_item_list(&self) -> Option<&[P<MetaItem>]>;
|
||||
|
||||
fn span(&self) -> Span;
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ impl AttrMetaMethods for Attribute {
|
|||
fn value_str(&self) -> Option<InternedString> {
|
||||
self.meta().value_str()
|
||||
}
|
||||
fn meta_item_list<'a>(&'a self) -> Option<&'a [P<MetaItem>]> {
|
||||
fn meta_item_list(&self) -> Option<&[P<MetaItem>]> {
|
||||
self.node.value.meta_item_list()
|
||||
}
|
||||
fn span(&self) -> Span { self.meta().span }
|
||||
|
|
@ -111,7 +111,7 @@ impl AttrMetaMethods for MetaItem {
|
|||
}
|
||||
}
|
||||
|
||||
fn meta_item_list<'a>(&'a self) -> Option<&'a [P<MetaItem>]> {
|
||||
fn meta_item_list(&self) -> Option<&[P<MetaItem>]> {
|
||||
match self.node {
|
||||
MetaList(_, ref l) => Some(&l[..]),
|
||||
_ => None
|
||||
|
|
@ -124,7 +124,7 @@ impl AttrMetaMethods for MetaItem {
|
|||
impl AttrMetaMethods for P<MetaItem> {
|
||||
fn name(&self) -> InternedString { (**self).name() }
|
||||
fn value_str(&self) -> Option<InternedString> { (**self).value_str() }
|
||||
fn meta_item_list<'a>(&'a self) -> Option<&'a [P<MetaItem>]> {
|
||||
fn meta_item_list(&self) -> Option<&[P<MetaItem>]> {
|
||||
(**self).meta_item_list()
|
||||
}
|
||||
fn span(&self) -> Span { (**self).span() }
|
||||
|
|
@ -132,14 +132,14 @@ impl AttrMetaMethods for P<MetaItem> {
|
|||
|
||||
|
||||
pub trait AttributeMethods {
|
||||
fn meta<'a>(&'a self) -> &'a MetaItem;
|
||||
fn meta(&self) -> &MetaItem;
|
||||
fn with_desugared_doc<T, F>(&self, f: F) -> T where
|
||||
F: FnOnce(&Attribute) -> T;
|
||||
}
|
||||
|
||||
impl AttributeMethods for Attribute {
|
||||
/// Extract the MetaItem from inside this Attribute.
|
||||
fn meta<'a>(&'a self) -> &'a MetaItem {
|
||||
fn meta(&self) -> &MetaItem {
|
||||
&*self.node.value
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ impl SyntaxEnv {
|
|||
self.chain.pop();
|
||||
}
|
||||
|
||||
fn find_escape_frame<'a>(&'a mut self) -> &'a mut MapChainFrame {
|
||||
fn find_escape_frame(&mut self) -> &mut MapChainFrame {
|
||||
for (i, frame) in self.chain.iter_mut().enumerate().rev() {
|
||||
if !frame.info.macros_escape || i == 0 {
|
||||
return frame
|
||||
|
|
@ -904,7 +904,7 @@ impl SyntaxEnv {
|
|||
self.find_escape_frame().map.insert(k, Rc::new(v));
|
||||
}
|
||||
|
||||
pub fn info<'a>(&'a mut self) -> &'a mut BlockInfo {
|
||||
pub fn info(&mut self) -> &mut BlockInfo {
|
||||
let last_chain_index = self.chain.len() - 1;
|
||||
&mut self.chain[last_chain_index].info
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ impl<T> SmallVector<T> {
|
|||
SmallVector { repr: Many(vs) }
|
||||
}
|
||||
|
||||
pub fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||
pub fn as_slice(&self) -> &[T] {
|
||||
match self.repr {
|
||||
Zero => {
|
||||
let result: &[T] = &[];
|
||||
|
|
@ -105,7 +105,7 @@ impl<T> SmallVector<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get<'a>(&'a self, idx: usize) -> &'a T {
|
||||
pub fn get(&self, idx: usize) -> &T {
|
||||
match self.repr {
|
||||
One(ref v) if idx == 0 => v,
|
||||
Many(ref vs) => &vs[idx],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue