Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Clippy warnings (v0.12.x) #428

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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