Remove needless lifetimes

This commit is contained in:
Jeremy Stucki 2019-06-21 17:46:41 +02:00 committed by Jeremy Stucki
parent 8301de16da
commit 87e8613fd4
No known key found for this signature in database
GPG Key ID: 8F548A5A2ED13F58
15 changed files with 21 additions and 21 deletions

View File

@ -2004,7 +2004,7 @@ impl<K, V> BTreeMap<K, V> {
/// assert_eq!(keys, [1, 2]); /// assert_eq!(keys, [1, 2]);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> { pub fn keys(&self) -> Keys<'_, K, V> {
Keys { inner: self.iter() } Keys { inner: self.iter() }
} }
@ -2025,7 +2025,7 @@ impl<K, V> BTreeMap<K, V> {
/// assert_eq!(values, ["hello", "goodbye"]); /// assert_eq!(values, ["hello", "goodbye"]);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn values<'a>(&'a self) -> Values<'a, K, V> { pub fn values(&self) -> Values<'_, K, V> {
Values { inner: self.iter() } Values { inner: self.iter() }
} }
@ -2529,8 +2529,8 @@ enum UnderflowResult<'a, K, V> {
Stole(NodeRef<marker::Mut<'a>, K, V, marker::Internal>), Stole(NodeRef<marker::Mut<'a>, K, V, marker::Internal>),
} }
fn handle_underfull_node<'a, K, V>(node: NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>) fn handle_underfull_node<K, V>(node: NodeRef<marker::Mut<'_>, K, V, marker::LeafOrInternal>)
-> UnderflowResult<'a, K, V> { -> UnderflowResult<'_, K, V> {
let parent = if let Ok(parent) = node.ascend() { let parent = if let Ok(parent) = node.ascend() {
parent parent
} else { } else {

View File

@ -394,7 +394,7 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
} }
/// Temporarily takes out another, immutable reference to the same node. /// Temporarily takes out another, immutable reference to the same node.
fn reborrow<'a>(&'a self) -> NodeRef<marker::Immut<'a>, K, V, Type> { fn reborrow(&self) -> NodeRef<marker::Immut<'_>, K, V, Type> {
NodeRef { NodeRef {
height: self.height, height: self.height,
node: self.node, node: self.node,

View File

@ -552,7 +552,7 @@ impl String {
/// assert_eq!("Hello <20>World", output); /// assert_eq!("Hello <20>World", output);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> Cow<'a, str> { pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str> {
let mut iter = lossy::Utf8Lossy::from_bytes(v).chunks(); let mut iter = lossy::Utf8Lossy::from_bytes(v).chunks();
let (first_valid, first_broken) = if let Some(chunk) = iter.next() { let (first_valid, first_broken) = if let Some(chunk) = iter.next() {

View File

@ -498,7 +498,7 @@ macro_rules! impls{
/// # end: *const T, /// # end: *const T,
/// # phantom: PhantomData<&'a T>, /// # phantom: PhantomData<&'a T>,
/// # } /// # }
/// fn borrow_vec<'a, T>(vec: &'a Vec<T>) -> Slice<'a, T> { /// fn borrow_vec<T>(vec: &Vec<T>) -> Slice<T> {
/// let ptr = vec.as_ptr(); /// let ptr = vec.as_ptr();
/// Slice { /// Slice {
/// start: ptr, /// start: ptr,

View File

@ -105,7 +105,7 @@ pub trait Index<Idx: ?Sized> {
/// impl Index<Side> for Balance { /// impl Index<Side> for Balance {
/// type Output = Weight; /// type Output = Weight;
/// ///
/// fn index<'a>(&'a self, index: Side) -> &'a Self::Output { /// fn index(&self, index: Side) -> &Self::Output {
/// println!("Accessing {:?}-side of balance immutably", index); /// println!("Accessing {:?}-side of balance immutably", index);
/// match index { /// match index {
/// Side::Left => &self.left, /// Side::Left => &self.left,
@ -115,7 +115,7 @@ pub trait Index<Idx: ?Sized> {
/// } /// }
/// ///
/// impl IndexMut<Side> for Balance { /// impl IndexMut<Side> for Balance {
/// fn index_mut<'a>(&'a mut self, index: Side) -> &'a mut Self::Output { /// fn index_mut(&mut self, index: Side) -> &mut Self::Output {
/// println!("Accessing {:?}-side of balance mutably", index); /// println!("Accessing {:?}-side of balance mutably", index);
/// match index { /// match index {
/// Side::Left => &mut self.left, /// Side::Left => &mut self.left,

View File

@ -74,7 +74,7 @@ impl<T: LambdaL> ScopedCell<T> {
} }
/// Sets the value in `self` to `value` while running `f`. /// Sets the value in `self` to `value` while running `f`.
pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R { pub fn set<R>(&self, value: <T as ApplyL<'_>>::Out, f: impl FnOnce() -> R) -> R {
self.replace(value, |_| f()) self.replace(value, |_| f())
} }
} }

View File

@ -140,7 +140,7 @@ fn wait_timeout_receiver<'a, 'b, T>(lock: &'a Mutex<State<T>>,
new_guard new_guard
} }
fn abort_selection<'a, T>(guard: &mut MutexGuard<'a , State<T>>) -> bool { fn abort_selection<T>(guard: &mut MutexGuard<'_, State<T>>) -> bool {
match mem::replace(&mut guard.blocker, NoneBlocked) { match mem::replace(&mut guard.blocker, NoneBlocked) {
NoneBlocked => true, NoneBlocked => true,
BlockedSender(token) => { BlockedSender(token) => {

View File

@ -673,7 +673,7 @@ impl UnixListener {
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket_redox", since = "1.29.0")] #[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn incoming<'a>(&'a self) -> Incoming<'a> { pub fn incoming(&self) -> Incoming {
Incoming { listener: self } Incoming { listener: self }
} }
} }

View File

@ -894,7 +894,7 @@ impl UnixListener {
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn incoming<'a>(&'a self) -> Incoming<'a> { pub fn incoming(&self) -> Incoming<'_> {
Incoming { listener: self } Incoming { listener: self }
} }
} }

View File

@ -195,7 +195,7 @@ fn wide_char_to_multi_byte(code_page: u32,
} }
} }
pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] { pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] {
match v.iter().position(|c| *c == 0) { match v.iter().position(|c| *c == 0) {
// don't include the 0 // don't include the 0
Some(i) => &v[..i], Some(i) => &v[..i],

View File

@ -19,7 +19,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'\\' b == b'\\'
} }
pub fn parse_prefix<'a>(path: &'a OsStr) -> Option<Prefix<'a>> { pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {
use crate::path::Prefix::*; use crate::path::Prefix::*;
unsafe { unsafe {
// The unsafety here stems from converting between &OsStr and &[u8] // The unsafety here stems from converting between &OsStr and &[u8]

View File

@ -16,7 +16,7 @@ pub mod test {
p.join(path) p.join(path)
} }
pub fn path<'a>(&'a self) -> &'a Path { pub fn path(&self) -> &Path {
let TempDir(ref p) = *self; let TempDir(ref p) = *self;
p p
} }

View File

@ -440,12 +440,12 @@ pub fn contains_name(attrs: &[Attribute], name: Symbol) -> bool {
}) })
} }
pub fn find_by_name<'a>(attrs: &'a [Attribute], name: Symbol) -> Option<&'a Attribute> { pub fn find_by_name(attrs: &[Attribute], name: Symbol) -> Option<&Attribute> {
attrs.iter().find(|attr| attr.check_name(name)) attrs.iter().find(|attr| attr.check_name(name))
} }
pub fn filter_by_name<'a>(attrs: &'a [Attribute], name: Symbol) pub fn filter_by_name(attrs: &[Attribute], name: Symbol)
-> impl Iterator<Item = &'a Attribute> { -> impl Iterator<Item=&Attribute> {
attrs.iter().filter(move |attr| attr.check_name(name)) attrs.iter().filter(move |attr| attr.check_name(name))
} }

View File

@ -901,7 +901,7 @@ fn may_begin_with(token: &Token, name: Name) -> bool {
/// # Returns /// # Returns
/// ///
/// The parsed non-terminal. /// The parsed non-terminal.
fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: Symbol) -> Nonterminal { fn parse_nt(p: &mut Parser<'_>, sp: Span, name: Symbol) -> Nonterminal {
if name == sym::tt { if name == sym::tt {
return token::NtTT(p.parse_token_tree()); return token::NtTT(p.parse_token_tree());
} }

View File

@ -20,7 +20,7 @@ pub fn string_to_stream(source_str: String) -> TokenStream {
} }
/// Map string to parser (via tts) /// Map string to parser (via tts)
pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { pub fn string_to_parser(ps: &ParseSess, source_str: String) -> Parser {
new_parser_from_source_str(ps, PathBuf::from("bogofile").into(), source_str) new_parser_from_source_str(ps, PathBuf::from("bogofile").into(), source_str)
} }