From 32f642aba46e07191cdc326d215d8df44118fe08 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 2 Jun 2024 18:50:55 +0800 Subject: [PATCH] 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));