From 9e141ee8991197f8b127bdb72f8e6b48141b1e7e Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 2 Jun 2024 18:36:41 +0800 Subject: [PATCH 1/3] Fix Clippy warnings clippy 0.1.78 (9b00956e 2024-04-29) --- examples/reinsert_expired_entries_sync.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/reinsert_expired_entries_sync.rs b/examples/reinsert_expired_entries_sync.rs index 23f5d2b0..ebad1945 100644 --- a/examples/reinsert_expired_entries_sync.rs +++ b/examples/reinsert_expired_entries_sync.rs @@ -1,3 +1,6 @@ +// This example requires Rust 1.70.0 or newer. +#![allow(clippy::incompatible_msrv)] + //! This example demonstrates how to write an eviction listener that will reinsert //! the expired entries. //! From 32f642aba46e07191cdc326d215d8df44118fe08 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 2 Jun 2024 18:50:55 +0800 Subject: [PATCH 2/3] Fix Clippy warnings clippy 0.1.79 (d9e85b56e7f 2024-05-25) --- src/common/concurrent/atomic_time/atomic_time.rs | 8 +++++--- src/common/frequency_sketch.rs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/concurrent/atomic_time/atomic_time.rs b/src/common/concurrent/atomic_time/atomic_time.rs index c24a895b..00ba1891 100644 --- a/src/common/concurrent/atomic_time/atomic_time.rs +++ b/src/common/concurrent/atomic_time/atomic_time.rs @@ -13,7 +13,7 @@ pub(crate) struct AtomicInstant { impl Default for AtomicInstant { fn default() -> Self { Self { - instant: AtomicU64::new(std::u64::MAX), + instant: AtomicU64::new(u64::MAX), } } } @@ -45,7 +45,9 @@ impl AtomicInstant { TypeId::of::(), TypeId::of::() ); - Some(Instant::new(unsafe { std::mem::transmute(ts) })) + Some(Instant::new(unsafe { + std::mem::transmute::(ts) + })) } } @@ -54,7 +56,7 @@ impl AtomicInstant { TypeId::of::(), TypeId::of::() ); - let ts = unsafe { std::mem::transmute(instant.inner_clock()) }; + let ts = unsafe { std::mem::transmute::(instant.inner_clock()) }; self.instant.store(ts, Ordering::Release); } } diff --git a/src/common/frequency_sketch.rs b/src/common/frequency_sketch.rs index c946137d..824c70b8 100644 --- a/src/common/frequency_sketch.rs +++ b/src/common/frequency_sketch.rs @@ -117,7 +117,7 @@ impl FrequencySketch { } let start = ((hash & 3) << 2) as u8; - let mut frequency = std::u8::MAX; + let mut frequency = u8::MAX; for i in 0..4 { let index = self.index_of(hash, i); let count = (self.table[index] >> ((start + i) << 2) & 0xF) as u8; @@ -257,7 +257,7 @@ mod tests { let mut sketch = FrequencySketch::default(); sketch.ensure_capacity(512); let mut indexes = std::collections::HashSet::new(); - let hashes = [std::u64::MAX, 0, 1]; + let hashes = [u64::MAX, 0, 1]; for hash in hashes.iter() { for depth in 0..4 { indexes.insert(sketch.index_of(*hash, depth)); From 23f2d521f67a5d61ab8169e78c1e6a047d3b6f9f Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 2 Jun 2024 18:58:18 +0800 Subject: [PATCH 3/3] Fix Clippy warnings clippy 0.1.79 (d9e85b56e7f 2024-05-25) --- src/common/concurrent/debug_counters.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/common/concurrent/debug_counters.rs b/src/common/concurrent/debug_counters.rs index 602ea8ec..4c704b3c 100644 --- a/src/common/concurrent/debug_counters.rs +++ b/src/common/concurrent/debug_counters.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "unstable-debug-counters")] - use crossbeam_utils::atomic::AtomicCell; use once_cell::sync::Lazy;