Skip to content

Commit

Permalink
Merge pull request #428 from moka-rs/fix-ci-2024-06-02/v0.12
Browse files Browse the repository at this point in the history
Fix Clippy warnings (v0.12.x)
  • Loading branch information
tatsuya6502 committed Jun 2, 2024
2 parents f3810e4 + 23f2d52 commit 0d7a383
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions examples/reinsert_expired_entries_sync.rs
Original file line number Diff line number Diff line change
@@ -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.
//!
Expand Down
8 changes: 5 additions & 3 deletions src/common/concurrent/atomic_time/atomic_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
}
Expand Down Expand Up @@ -45,7 +45,9 @@ impl AtomicInstant {
TypeId::of::<ClockInstant>(),
TypeId::of::<quanta::Instant>()
);
Some(Instant::new(unsafe { std::mem::transmute(ts) }))
Some(Instant::new(unsafe {
std::mem::transmute::<u64, quanta::Instant>(ts)
}))
}
}

Expand All @@ -54,7 +56,7 @@ impl AtomicInstant {
TypeId::of::<ClockInstant>(),
TypeId::of::<quanta::Instant>()
);
let ts = unsafe { std::mem::transmute(instant.inner_clock()) };
let ts = unsafe { std::mem::transmute::<quanta::Instant, u64>(instant.inner_clock()) };
self.instant.store(ts, Ordering::Release);
}
}
2 changes: 0 additions & 2 deletions src/common/concurrent/debug_counters.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(feature = "unstable-debug-counters")]

use crossbeam_utils::atomic::AtomicCell;
use once_cell::sync::Lazy;

Expand Down
4 changes: 2 additions & 2 deletions src/common/frequency_sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 0d7a383

Please sign in to comment.