Fix some "needless lifetime" clippy lints

These lints seem to be new in clippy nightly.
This commit is contained in:
teor 2020-10-12 08:32:05 +10:00
parent fd0fac3a61
commit 1e97691fc8
2 changed files with 7 additions and 9 deletions

View File

@ -140,14 +140,14 @@ impl AddressBook {
/// Return an iterator over all peers, ordered from most recently seen to
/// least recently seen.
pub fn peers<'a>(&'a self) -> impl Iterator<Item = MetaAddr> + 'a {
pub fn peers(&'_ self) -> impl Iterator<Item = MetaAddr> + '_ {
let _guard = self.span.enter();
self.by_time.iter().rev().cloned()
}
/// Return an iterator over peers known to be disconnected, ordered from most
/// recently seen to least recently seen.
pub fn disconnected_peers<'a>(&'a self) -> impl Iterator<Item = MetaAddr> + 'a {
pub fn disconnected_peers(&'_ self) -> impl Iterator<Item = MetaAddr> + '_ {
let _guard = self.span.enter();
use std::ops::Bound::{Excluded, Unbounded};
@ -159,7 +159,7 @@ impl AddressBook {
/// Return an iterator over peers that could potentially be connected, ordered from most
/// recently seen to least recently seen.
pub fn potentially_connected_peers<'a>(&'a self) -> impl Iterator<Item = MetaAddr> + 'a {
pub fn potentially_connected_peers(&'_ self) -> impl Iterator<Item = MetaAddr> + '_ {
let _guard = self.span.enter();
use std::ops::Bound::{Included, Unbounded};
@ -171,7 +171,7 @@ impl AddressBook {
/// Returns an iterator that drains entries from the address book, removing
/// them in order from most recent to least recent.
pub fn drain_newest<'a>(&'a mut self) -> impl Iterator<Item = MetaAddr> + 'a {
pub fn drain_newest(&'_ mut self) -> impl Iterator<Item = MetaAddr> + '_ {
Drain {
book: self,
newest_first: true,
@ -180,7 +180,7 @@ impl AddressBook {
/// Returns an iterator that drains entries from the address book, removing
/// them in order from least recent to most recent.
pub fn drain_oldest<'a>(&'a mut self) -> impl Iterator<Item = MetaAddr> + 'a {
pub fn drain_oldest(&'_ mut self) -> impl Iterator<Item = MetaAddr> + '_ {
Drain {
book: self,
newest_first: false,

View File

@ -726,9 +726,7 @@ where
}
}
fn transaction_hashes<'a>(
items: &'a [InventoryHash],
) -> impl Iterator<Item = transaction::Hash> + 'a {
fn transaction_hashes(items: &'_ [InventoryHash]) -> impl Iterator<Item = transaction::Hash> + '_ {
items.iter().filter_map(|item| {
if let InventoryHash::Tx(hash) = item {
Some(*hash)
@ -738,7 +736,7 @@ fn transaction_hashes<'a>(
})
}
fn block_hashes<'a>(items: &'a [InventoryHash]) -> impl Iterator<Item = block::Hash> + 'a {
fn block_hashes(items: &'_ [InventoryHash]) -> impl Iterator<Item = block::Hash> + '_ {
items.iter().filter_map(|item| {
if let InventoryHash::Block(hash) = item {
Some(*hash)