Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy needless_lifetimes lint #523

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ where
}
}

impl<'a, T> Drop for Hole<'a, T> {
impl<T> Drop for Hole<'_, T> {
#[inline]
fn drop(&mut self) {
// fill the hole again
Expand Down
12 changes: 6 additions & 6 deletions src/deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,15 @@ impl<'a, T> Iterator for Iter<'a, T> {
}
}

impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
impl<T> DoubleEndedIterator for Iter<'_, T> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back()
}
}

impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
impl<'a, T> FusedIterator for Iter<'a, T> {}
impl<T> ExactSizeIterator for Iter<'_, T> {}
impl<T> FusedIterator for Iter<'_, T> {}

impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T;
Expand All @@ -847,15 +847,15 @@ impl<'a, T> Iterator for IterMut<'a, T> {
}
}

impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
impl<T> DoubleEndedIterator for IterMut<'_, T> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back()
}
}

impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
impl<'a, T> FusedIterator for IterMut<'a, T> {}
impl<T> ExactSizeIterator for IterMut<'_, T> {}
impl<T> FusedIterator for IterMut<'_, T> {}

// Trait implementations

Expand Down
4 changes: 2 additions & 2 deletions src/histbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ impl<'a, T> OldestOrderedView<'a, T> {
}
}

impl<'a, T, S: Storage> Clone for OldestOrderedInner<'a, T, S> {
impl<T, S: Storage> Clone for OldestOrderedInner<'_, T, S> {
fn clone(&self) -> Self {
Self {
phantom: PhantomData,
Expand All @@ -555,7 +555,7 @@ impl<'a, T, S: Storage> Iterator for OldestOrderedInner<'a, T, S> {
}
}

impl<'a, T, const N: usize> DoubleEndedIterator for OldestOrdered<'a, T, N> {
impl<T, const N: usize> DoubleEndedIterator for OldestOrdered<'_, T, N> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back()
}
Expand Down
6 changes: 3 additions & 3 deletions src/indexmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ where
}
}

impl<'a, K, Q, V, S, const N: usize> ops::Index<&'a Q> for IndexMap<K, V, S, N>
impl<K, Q, V, S, const N: usize> ops::Index<&Q> for IndexMap<K, V, S, N>
where
K: Eq + Hash + Borrow<Q>,
Q: ?Sized + Eq + Hash,
Expand All @@ -1196,7 +1196,7 @@ where
}
}

impl<'a, K, Q, V, S, const N: usize> ops::IndexMut<&'a Q> for IndexMap<K, V, S, N>
impl<K, Q, V, S, const N: usize> ops::IndexMut<&Q> for IndexMap<K, V, S, N>
where
K: Eq + Hash + Borrow<Q>,
Q: ?Sized + Eq + Hash,
Expand Down Expand Up @@ -1373,7 +1373,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
}
}

impl<'a, K, V> Clone for Iter<'a, K, V> {
impl<K, V> Clone for Iter<'_, K, V> {
fn clone(&self) -> Self {
Self {
iter: self.iter.clone(),
Expand Down
2 changes: 1 addition & 1 deletion src/indexset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
}
}

impl<'a, T> Clone for Iter<'a, T> {
impl<T> Clone for Iter<'_, T> {
fn clone(&self) -> Self {
Self {
iter: self.iter.clone(),
Expand Down
4 changes: 2 additions & 2 deletions src/linear_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ where
}
}

impl<'a, K, V, Q, S: Storage> ops::Index<&'a Q> for LinearMapInner<K, V, S>
impl<K, V, Q, S: Storage> ops::Index<&Q> for LinearMapInner<K, V, S>
where
K: Borrow<Q> + Eq,
Q: Eq + ?Sized,
Expand All @@ -404,7 +404,7 @@ where
}
}

impl<'a, K, V, Q, S: Storage> ops::IndexMut<&'a Q> for LinearMapInner<K, V, S>
impl<K, V, Q, S: Storage> ops::IndexMut<&Q> for LinearMapInner<K, V, S>
where
K: Borrow<Q> + Eq,
Q: Eq + ?Sized,
Expand Down
2 changes: 1 addition & 1 deletion src/sorted_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ pub type FindMut<'a, T, Idx, K, const N: usize> = FindMutInner<'a, T, Idx, K, Ow
/// Comes from [`SortedLinkedList::find_mut`].
pub type FindMutView<'a, T, Idx, K, const N: usize> = FindMutInner<'a, T, Idx, K, ViewStorage>;

impl<'a, T, Idx, K, S> FindMutInner<'a, T, Idx, K, S>
impl<T, Idx, K, S> FindMutInner<'_, T, Idx, K, S>
where
T: Ord,
Idx: SortedLinkedListIndex,
Expand Down
14 changes: 7 additions & 7 deletions src/spsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ pub type Iter<'a, T, const N: usize> = IterInner<'a, T, OwnedStorage<N>>;
/// An iterator over the items of a queue
pub type IterView<'a, T> = IterInner<'a, T, ViewStorage>;

impl<'a, T, const N: usize> Clone for Iter<'a, T, N> {
impl<T, const N: usize> Clone for Iter<'_, T, N> {
fn clone(&self) -> Self {
Self {
rb: self.rb,
Expand Down Expand Up @@ -465,7 +465,7 @@ impl<'a, T, S: Storage> Iterator for IterMutInner<'a, T, S> {
}
}

impl<'a, T, S: Storage> DoubleEndedIterator for IterInner<'a, T, S> {
impl<T, S: Storage> DoubleEndedIterator for IterInner<'_, T, S> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.index < self.len {
let head = self.rb.head.load(Ordering::Relaxed);
Expand All @@ -480,7 +480,7 @@ impl<'a, T, S: Storage> DoubleEndedIterator for IterInner<'a, T, S> {
}
}

impl<'a, T, S: Storage> DoubleEndedIterator for IterMutInner<'a, T, S> {
impl<T, S: Storage> DoubleEndedIterator for IterMutInner<'_, T, S> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.index < self.len {
let head = self.rb.head.load(Ordering::Relaxed);
Expand Down Expand Up @@ -562,7 +562,7 @@ pub type Consumer<'a, T, const N: usize> = ConsumerInner<'a, T, OwnedStorage<N>>
/// NOTE the consumer semantically owns the `head` pointer of the queue
pub type ConsumerView<'a, T> = ConsumerInner<'a, T, ViewStorage>;

unsafe impl<'a, T, S: Storage> Send for ConsumerInner<'a, T, S> where T: Send {}
unsafe impl<T, S: Storage> Send for ConsumerInner<'_, T, S> where T: Send {}

/// Base struct for [`Producer`] and [`ProducerView`], generic over the [`Storage`].
///
Expand All @@ -580,9 +580,9 @@ pub type Producer<'a, T, const N: usize> = ProducerInner<'a, T, OwnedStorage<N>>
/// NOTE the producer semantically owns the `tail` pointer of the queue
pub type ProducerView<'a, T> = ProducerInner<'a, T, ViewStorage>;

unsafe impl<'a, T, S: Storage> Send for ProducerInner<'a, T, S> where T: Send {}
unsafe impl<T, S: Storage> Send for ProducerInner<'_, T, S> where T: Send {}

impl<'a, T, S: Storage> ConsumerInner<'a, T, S> {
impl<T, S: Storage> ConsumerInner<'_, T, S> {
/// Returns the item in the front of the queue, or `None` if the queue is empty
#[inline]
pub fn dequeue(&mut self) -> Option<T> {
Expand Down Expand Up @@ -657,7 +657,7 @@ impl<'a, T, S: Storage> ConsumerInner<'a, T, S> {
}
}

impl<'a, T, S: Storage> ProducerInner<'a, T, S> {
impl<T, S: Storage> ProducerInner<'_, T, S> {
/// Adds an `item` to the end of the queue, returns back the `item` if the queue is full
#[inline]
pub fn enqueue(&mut self, val: T) -> Result<(), T> {
Expand Down
2 changes: 1 addition & 1 deletion src/string/drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Drop for Drain<'_> {
}
}

impl<'a> Drain<'a> {
impl Drain<'_> {
/// Returns the remaining (sub)string of this iterator as a slice.
///
/// # Examples
Expand Down
6 changes: 3 additions & 3 deletions src/vec/drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> {
}
}

impl<'a, T> Drain<'a, T> {
impl<T> Drain<'_, T> {
/// Returns the remaining items of this iterator as a slice.
///
/// # Examples
Expand All @@ -57,7 +57,7 @@ impl<'a, T> Drain<'a, T> {
}
}

impl<'a, T> AsRef<[T]> for Drain<'a, T> {
impl<T> AsRef<[T]> for Drain<'_, T> {
fn as_ref(&self) -> &[T] {
self.as_slice()
}
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<T> Drop for Drain<'_, T> {
/// Moves back the un-`Drain`ed elements to restore the original `Vec`.
struct DropGuard<'r, 'a, T>(&'r mut Drain<'a, T>);

impl<'r, 'a, T> Drop for DropGuard<'r, 'a, T> {
impl<T> Drop for DropGuard<'_, '_, T> {
fn drop(&mut self) {
if self.0.tail_len > 0 {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ impl<T, S: Storage> VecInner<T, S> {
original_len: usize,
}

impl<'a, T, S: Storage> Drop for BackshiftOnDrop<'a, T, S> {
impl<T, S: Storage> Drop for BackshiftOnDrop<'_, T, S> {
fn drop(&mut self) {
if self.deleted_cnt > 0 {
// SAFETY: Trailing unchecked items must be valid since we never touch them.
Expand Down
Loading