From bc368f3998f7e57a05ee18a9656854f3380462cb Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 3 Nov 2024 00:30:45 +0000 Subject: [PATCH 1/2] Fix Clippy warnings - Fix beta Clippy warnings - clippy 0.1.83 (f41c7ed9889 2024-10-31) --- src/cht/iter.rs | 4 ++-- src/cht/map/bucket.rs | 2 +- src/cht/map/bucket_array_ref.rs | 4 ++-- src/common/deque.rs | 2 +- src/common/timer_wheel.rs | 4 ++-- src/future.rs | 4 ++-- src/future/key_lock.rs | 2 +- src/future/value_initializer.rs | 2 +- src/sync/cache.rs | 1 - src/sync_base/iter.rs | 16 +++++++++++++--- src/sync_base/key_lock.rs | 2 +- 11 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/cht/iter.rs b/src/cht/iter.rs index c3ae46a1..a6491f69 100644 --- a/src/cht/iter.rs +++ b/src/cht/iter.rs @@ -35,7 +35,7 @@ impl<'i, K, V> Iter<'i, K, V> { } } -impl<'i, K, V> Iterator for Iter<'i, K, V> +impl Iterator for Iter<'_, K, V> where K: Eq + Hash + Clone + Send + Sync + 'static, V: Clone + Send + Sync + 'static, @@ -58,7 +58,7 @@ where } } -impl<'i, K, V> Iter<'i, K, V> +impl Iter<'_, K, V> where K: Eq + Hash + Clone + Send + Sync + 'static, V: Clone + Send + Sync + 'static, diff --git a/src/cht/map/bucket.rs b/src/cht/map/bucket.rs index 94282750..eb0b9329 100644 --- a/src/cht/map/bucket.rs +++ b/src/cht/map/bucket.rs @@ -369,7 +369,7 @@ struct Probe<'b, 'g, K: 'g, V: 'g> { reload: bool, } -impl<'b, 'g, K: 'g, V: 'g> Probe<'b, 'g, K, V> { +impl<'g, K: 'g, V: 'g> Probe<'_, 'g, K, V> { fn reload(&mut self) { self.reload = true; } diff --git a/src/cht/map/bucket_array_ref.rs b/src/cht/map/bucket_array_ref.rs index 761ec45c..38b22fbd 100644 --- a/src/cht/map/bucket_array_ref.rs +++ b/src/cht/map/bucket_array_ref.rs @@ -13,7 +13,7 @@ pub(crate) struct BucketArrayRef<'a, K, V, S> { pub(crate) len: &'a AtomicUsize, } -impl<'a, K, V, S> BucketArrayRef<'a, K, V, S> +impl BucketArrayRef<'_, K, V, S> where K: Hash + Eq, S: BuildHasher, @@ -293,7 +293,7 @@ where } } -impl<'a, 'g, K, V, S> BucketArrayRef<'a, K, V, S> { +impl<'g, K, V, S> BucketArrayRef<'_, K, V, S> { fn get(&self, guard: &'g Guard) -> &'g BucketArray { let mut maybe_new_bucket_array = None; diff --git a/src/common/deque.rs b/src/common/deque.rs index 3acca001..629cf4bb 100644 --- a/src/common/deque.rs +++ b/src/common/deque.rs @@ -83,7 +83,7 @@ impl Drop for Deque { fn drop(&mut self) { struct DropGuard<'a, T>(&'a mut Deque); - impl<'a, T> Drop for DropGuard<'a, T> { + impl Drop for DropGuard<'_, T> { fn drop(&mut self) { // Continue the same loop we do below. This only runs when a destructor has // panicked. If another one panics this will abort. diff --git a/src/common/timer_wheel.rs b/src/common/timer_wheel.rs index aa78affa..2e27fbfd 100644 --- a/src/common/timer_wheel.rs +++ b/src/common/timer_wheel.rs @@ -440,7 +440,7 @@ impl<'iter, K> TimerEventsIter<'iter, K> { } } -impl<'iter, K> Drop for TimerEventsIter<'iter, K> { +impl Drop for TimerEventsIter<'_, K> { fn drop(&mut self) { if !self.is_done { // This iterator was dropped before consuming all events. Reset the @@ -451,7 +451,7 @@ impl<'iter, K> Drop for TimerEventsIter<'iter, K> { } } -impl<'iter, K> Iterator for TimerEventsIter<'iter, K> { +impl Iterator for TimerEventsIter<'_, K> { type Item = TimerEvent; /// NOTE: When necessary, this iterator will unset the timer node pointer in the diff --git a/src/future.rs b/src/future.rs index 654b3eb7..b2124466 100644 --- a/src/future.rs +++ b/src/future.rs @@ -63,7 +63,7 @@ impl<'i, K, V> Iter<'i, K, V> { } } -impl<'i, K, V> Iterator for Iter<'i, K, V> +impl Iterator for Iter<'_, K, V> where K: Eq + Hash + Send + Sync + 'static, V: Clone + Send + Sync + 'static, @@ -131,7 +131,7 @@ impl<'a, K, V> CancelGuard<'a, K, V> { } } -impl<'a, K, V> Drop for CancelGuard<'a, K, V> { +impl Drop for CancelGuard<'_, K, V> { fn drop(&mut self) { let interrupted_op = match (self.future.take(), self.op.take()) { (Some(future), Some(op)) => InterruptedOp::CallEvictionListener { diff --git a/src/future/key_lock.rs b/src/future/key_lock.rs index fc06ff2f..4d63c46a 100644 --- a/src/future/key_lock.rs +++ b/src/future/key_lock.rs @@ -24,7 +24,7 @@ where lock: TrioArc>, } -impl<'a, K, S> Drop for KeyLock<'a, K, S> +impl Drop for KeyLock<'_, K, S> where K: Eq + Hash, S: BuildHasher, diff --git a/src/future/value_initializer.rs b/src/future/value_initializer.rs index 63b7a341..1e727e2b 100644 --- a/src/future/value_initializer.rs +++ b/src/future/value_initializer.rs @@ -94,7 +94,7 @@ where } } -impl<'a, K, V, S> Drop for WaiterGuard<'a, K, V, S> +impl Drop for WaiterGuard<'_, K, V, S> where K: Eq + Hash, V: Clone, diff --git a/src/sync/cache.rs b/src/sync/cache.rs index 789855a1..6df8773d 100644 --- a/src/sync/cache.rs +++ b/src/sync/cache.rs @@ -570,7 +570,6 @@ use std::{ /// /// [builder-name-method]: ./struct.CacheBuilder.html#method.name /// - pub struct Cache { pub(crate) base: BaseCache, value_initializer: Arc>, diff --git a/src/sync_base/iter.rs b/src/sync_base/iter.rs index 7e518036..3f725727 100644 --- a/src/sync_base/iter.rs +++ b/src/sync_base/iter.rs @@ -59,7 +59,7 @@ impl<'i, K, V> Iter<'i, K, V> { } } -impl<'i, K, V> Iterator for Iter<'i, K, V> +impl Iterator for Iter<'_, K, V> where K: Eq + Hash + Send + Sync + 'static, V: Clone + Send + Sync + 'static, @@ -124,14 +124,24 @@ where } } -unsafe impl<'a, 'i, K, V> Send for Iter<'i, K, V> +// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a. +// This seems a false positive. The lifetimes are used in the Send and Sync impls. +// Let's suppress the warning. +// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes +#[allow(clippy::extra_unused_lifetimes)] +unsafe impl<'a, K, V> Send for Iter<'_, K, V> where K: 'a + Eq + Hash + Send, V: 'a + Send, { } -unsafe impl<'a, 'i, K, V> Sync for Iter<'i, K, V> +// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a. +// This seems a false positive. The lifetimes are used in the Send and Sync impls. +// Let's suppress the warning. +// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes +#[allow(clippy::extra_unused_lifetimes)] +unsafe impl<'a, K, V> Sync for Iter<'_, K, V> where K: 'a + Eq + Hash + Sync, V: 'a + Sync, diff --git a/src/sync_base/key_lock.rs b/src/sync_base/key_lock.rs index abc96873..4722b996 100644 --- a/src/sync_base/key_lock.rs +++ b/src/sync_base/key_lock.rs @@ -24,7 +24,7 @@ where lock: TrioArc>, } -impl<'a, K, S> Drop for KeyLock<'a, K, S> +impl Drop for KeyLock<'_, K, S> where K: Eq + Hash, S: BuildHasher, From c84c8579aded2bffd524c5e766f5a8d21adeb3ff Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 3 Nov 2024 00:48:45 +0000 Subject: [PATCH 2/2] Fix the CI for nightly + minimal crate versions - Unpin the proc-macro2 version. --- .ci_extras/pin-crate-vers-nightly.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci_extras/pin-crate-vers-nightly.sh b/.ci_extras/pin-crate-vers-nightly.sh index 87d75437..c4af60b2 100755 --- a/.ci_extras/pin-crate-vers-nightly.sh +++ b/.ci_extras/pin-crate-vers-nightly.sh @@ -3,6 +3,5 @@ set -eux # Pin some dependencies to specific versions for the nightly toolchain. -cargo update -p proc-macro2 --precise 1.0.63 # https://github.com/tkaitchuck/aHash/issues/200 cargo update -p ahash --precise 0.8.7