From 204e101523d55bf2cd63b073ef74a00ab048fcec Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sat, 7 Sep 2024 13:14:35 +0100 Subject: [PATCH 1/2] Fix unexpected_cfgs warnings --- Cargo.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 91d06e0..8d3a35d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,3 +48,12 @@ trybuild = "1.0" # Build the doc with some features enabled. features = [] rustdoc-args = ["--cfg", "docsrs"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + "cfg(kani)", + "cfg(skeptic)", + "cfg(circleci)", + "cfg(trybuild)", + "cfg(beta_clippy)", +] } From 19db5418e81446fa58cbe422acfda9bdd32f43e2 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sat, 7 Sep 2024 13:17:24 +0100 Subject: [PATCH 2/2] Fix clippy::unnecessary_min_or_max --- src/common/frequency_sketch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/frequency_sketch.rs b/src/common/frequency_sketch.rs index 1055ddb..a1e8d2d 100644 --- a/src/common/frequency_sketch.rs +++ b/src/common/frequency_sketch.rs @@ -17,7 +17,7 @@ #[derive(Default)] pub(crate) struct FrequencySketch { sample_size: u32, - table_mask: u64, + table_mask: u32, table: Box<[u64]>, size: u32, } @@ -101,7 +101,7 @@ impl FrequencySketch { } self.table = vec![0; table_size as usize].into_boxed_slice(); - self.table_mask = 0.max(table_size - 1) as u64; + self.table_mask = table_size - 1; self.sample_size = if cap == 0 { 10 } else { @@ -181,7 +181,7 @@ impl FrequencySketch { let i = depth as usize; let mut hash = hash.wrapping_add(SEED[i]).wrapping_mul(SEED[i]); hash = hash.wrapping_add(hash >> 32); - (hash & self.table_mask) as usize + (hash & (self.table_mask as u64)) as usize } }