Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
clippy 0.1.79 (d9e85b56e7f 2024-05-25)
  • Loading branch information
tatsuya6502 committed Jun 2, 2024
1 parent 9e141ee commit 32f642a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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);
}
}
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 32f642a

Please sign in to comment.