From dc158dc34afc54c0c9ab4515424966972fbb761c Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 15 Dec 2024 09:05:01 -0800 Subject: [PATCH] Fix clippy needless_lifetimes lint --- src/binary_heap.rs | 2 +- src/deque.rs | 12 ++++++------ src/histbuf.rs | 4 ++-- src/indexmap.rs | 6 +++--- src/indexset.rs | 2 +- src/linear_map.rs | 4 ++-- src/sorted_linked_list.rs | 2 +- src/spsc.rs | 14 +++++++------- src/string/drain.rs | 2 +- src/vec/drain.rs | 6 +++--- src/vec/mod.rs | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/binary_heap.rs b/src/binary_heap.rs index c275682ba4..3e23087425 100644 --- a/src/binary_heap.rs +++ b/src/binary_heap.rs @@ -613,7 +613,7 @@ where } } -impl<'a, T> Drop for Hole<'a, T> { +impl Drop for Hole<'_, T> { #[inline] fn drop(&mut self) { // fill the hole again diff --git a/src/deque.rs b/src/deque.rs index 4c0bec81dc..a4ce2e2221 100644 --- a/src/deque.rs +++ b/src/deque.rs @@ -825,15 +825,15 @@ impl<'a, T> Iterator for Iter<'a, T> { } } -impl<'a, T> DoubleEndedIterator for Iter<'a, T> { +impl DoubleEndedIterator for Iter<'_, T> { #[inline] fn next_back(&mut self) -> Option { self.inner.next_back() } } -impl<'a, T> ExactSizeIterator for Iter<'a, T> {} -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl ExactSizeIterator for Iter<'_, T> {} +impl FusedIterator for Iter<'_, T> {} impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -847,15 +847,15 @@ impl<'a, T> Iterator for IterMut<'a, T> { } } -impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { +impl DoubleEndedIterator for IterMut<'_, T> { #[inline] fn next_back(&mut self) -> Option { self.inner.next_back() } } -impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} -impl<'a, T> FusedIterator for IterMut<'a, T> {} +impl ExactSizeIterator for IterMut<'_, T> {} +impl FusedIterator for IterMut<'_, T> {} // Trait implementations diff --git a/src/histbuf.rs b/src/histbuf.rs index 93e79fbe33..4994e42769 100644 --- a/src/histbuf.rs +++ b/src/histbuf.rs @@ -534,7 +534,7 @@ impl<'a, T> OldestOrderedView<'a, T> { } } -impl<'a, T, S: Storage> Clone for OldestOrderedInner<'a, T, S> { +impl Clone for OldestOrderedInner<'_, T, S> { fn clone(&self) -> Self { Self { phantom: PhantomData, @@ -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 DoubleEndedIterator for OldestOrdered<'_, T, N> { fn next_back(&mut self) -> Option { self.inner.next_back() } diff --git a/src/indexmap.rs b/src/indexmap.rs index 1d99d72a43..888a8efc7c 100644 --- a/src/indexmap.rs +++ b/src/indexmap.rs @@ -1183,7 +1183,7 @@ where } } -impl<'a, K, Q, V, S, const N: usize> ops::Index<&'a Q> for IndexMap +impl ops::Index<&Q> for IndexMap where K: Eq + Hash + Borrow, Q: ?Sized + Eq + Hash, @@ -1196,7 +1196,7 @@ where } } -impl<'a, K, Q, V, S, const N: usize> ops::IndexMut<&'a Q> for IndexMap +impl ops::IndexMut<&Q> for IndexMap where K: Eq + Hash + Borrow, Q: ?Sized + Eq + Hash, @@ -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 Clone for Iter<'_, K, V> { fn clone(&self) -> Self { Self { iter: self.iter.clone(), diff --git a/src/indexset.rs b/src/indexset.rs index ef80a8aa43..89aae8942b 100644 --- a/src/indexset.rs +++ b/src/indexset.rs @@ -621,7 +621,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } } -impl<'a, T> Clone for Iter<'a, T> { +impl Clone for Iter<'_, T> { fn clone(&self) -> Self { Self { iter: self.iter.clone(), diff --git a/src/linear_map.rs b/src/linear_map.rs index d6e74df480..ca52cd29ef 100644 --- a/src/linear_map.rs +++ b/src/linear_map.rs @@ -392,7 +392,7 @@ where } } -impl<'a, K, V, Q, S: Storage> ops::Index<&'a Q> for LinearMapInner +impl ops::Index<&Q> for LinearMapInner where K: Borrow + Eq, Q: Eq + ?Sized, @@ -404,7 +404,7 @@ where } } -impl<'a, K, V, Q, S: Storage> ops::IndexMut<&'a Q> for LinearMapInner +impl ops::IndexMut<&Q> for LinearMapInner where K: Borrow + Eq, Q: Eq + ?Sized, diff --git a/src/sorted_linked_list.rs b/src/sorted_linked_list.rs index a3c9cb502f..9f37ff3c6e 100644 --- a/src/sorted_linked_list.rs +++ b/src/sorted_linked_list.rs @@ -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 FindMutInner<'_, T, Idx, K, S> where T: Ord, Idx: SortedLinkedListIndex, diff --git a/src/spsc.rs b/src/spsc.rs index 9ebcb996ab..5807f5387b 100644 --- a/src/spsc.rs +++ b/src/spsc.rs @@ -405,7 +405,7 @@ pub type Iter<'a, T, const N: usize> = IterInner<'a, T, OwnedStorage>; /// 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 Clone for Iter<'_, T, N> { fn clone(&self) -> Self { Self { rb: self.rb, @@ -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 DoubleEndedIterator for IterInner<'_, T, S> { fn next_back(&mut self) -> Option { if self.index < self.len { let head = self.rb.head.load(Ordering::Relaxed); @@ -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 DoubleEndedIterator for IterMutInner<'_, T, S> { fn next_back(&mut self) -> Option { if self.index < self.len { let head = self.rb.head.load(Ordering::Relaxed); @@ -562,7 +562,7 @@ pub type Consumer<'a, T, const N: usize> = ConsumerInner<'a, T, OwnedStorage> /// 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 Send for ConsumerInner<'_, T, S> where T: Send {} /// Base struct for [`Producer`] and [`ProducerView`], generic over the [`Storage`]. /// @@ -580,9 +580,9 @@ pub type Producer<'a, T, const N: usize> = ProducerInner<'a, T, OwnedStorage> /// 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 Send for ProducerInner<'_, T, S> where T: Send {} -impl<'a, T, S: Storage> ConsumerInner<'a, T, S> { +impl 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 { @@ -657,7 +657,7 @@ impl<'a, T, S: Storage> ConsumerInner<'a, T, S> { } } -impl<'a, T, S: Storage> ProducerInner<'a, T, S> { +impl 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> { diff --git a/src/string/drain.rs b/src/string/drain.rs index 11a708c2e7..caa93659ff 100644 --- a/src/string/drain.rs +++ b/src/string/drain.rs @@ -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 diff --git a/src/vec/drain.rs b/src/vec/drain.rs index f501cfb188..d43355fd7a 100644 --- a/src/vec/drain.rs +++ b/src/vec/drain.rs @@ -37,7 +37,7 @@ impl fmt::Debug for Drain<'_, T> { } } -impl<'a, T> Drain<'a, T> { +impl Drain<'_, T> { /// Returns the remaining items of this iterator as a slice. /// /// # Examples @@ -57,7 +57,7 @@ impl<'a, T> Drain<'a, T> { } } -impl<'a, T> AsRef<[T]> for Drain<'a, T> { +impl AsRef<[T]> for Drain<'_, T> { fn as_ref(&self) -> &[T] { self.as_slice() } @@ -95,7 +95,7 @@ impl 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 Drop for DropGuard<'_, '_, T> { fn drop(&mut self) { if self.0.tail_len > 0 { unsafe { diff --git a/src/vec/mod.rs b/src/vec/mod.rs index 1e1583a43e..05ec3cdf32 100644 --- a/src/vec/mod.rs +++ b/src/vec/mod.rs @@ -1000,7 +1000,7 @@ impl VecInner { original_len: usize, } - impl<'a, T, S: Storage> Drop for BackshiftOnDrop<'a, T, S> { + impl 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.