From a953cf2461a37c49d417bcca85895097c7cb3d90 Mon Sep 17 00:00:00 2001 From: James Hodgkinson Date: Wed, 26 Jun 2024 10:48:19 +1000 Subject: [PATCH] minor linting fixes --- src/arcache/mod.rs | 4 +++- src/internals/hashtrie/cursor.rs | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/arcache/mod.rs b/src/arcache/mod.rs index 7c1de3a..f26ae92 100644 --- a/src/arcache/mod.rs +++ b/src/arcache/mod.rs @@ -2962,9 +2962,10 @@ mod tests { } #[allow(dead_code)] + pub static RUNNING: AtomicBool = AtomicBool::new(false); - #[allow(dead_code)] + #[cfg(test)] fn multi_thread_worker(arc: Arc, Box>>) { while RUNNING.load(Ordering::Relaxed) { let mut rd_txn = arc.read(); @@ -2982,6 +2983,7 @@ mod tests { #[allow(dead_code)] #[cfg_attr(miri, ignore)] #[cfg_attr(feature = "dhat-heap", test)] + #[cfg(test)] fn test_cache_stress_1() { #[cfg(feature = "dhat-heap")] let _profiler = dhat::Profiler::builder().trim_backtraces(None).build(); diff --git a/src/internals/hashtrie/cursor.rs b/src/internals/hashtrie/cursor.rs index ae8f5ce..b3321fe 100644 --- a/src/internals/hashtrie/cursor.rs +++ b/src/internals/hashtrie/cursor.rs @@ -33,8 +33,7 @@ use std::hash::{BuildHasher, Hash, Hasher}; #[cfg(feature = "hashtrie_skinny")] pub(crate) const MAX_HEIGHT: u64 = 8; // The true absolute max height -#[cfg(feature = "hashtrie_skinny")] -#[cfg(test)] +#[cfg(all(feature = "hashtrie_skinny", any(test, debug_assertions)))] const ABS_MAX_HEIGHT: u64 = 21; #[cfg(feature = "hashtrie_skinny")] pub(crate) const HT_CAPACITY: usize = 8; @@ -47,8 +46,7 @@ const SHIFT: u64 = 3; // This defines the max height of our tree. Gives 16777216.0 entries #[cfg(not(feature = "hashtrie_skinny"))] pub(crate) const MAX_HEIGHT: u64 = 6; -#[cfg(not(feature = "hashtrie_skinny"))] -#[cfg(test)] +#[cfg(all(not(feature = "hashtrie_skinny"), any(test, debug_assertions)))] const ABS_MAX_HEIGHT: u64 = 16; #[cfg(not(feature = "hashtrie_skinny"))] pub(crate) const HT_CAPACITY: usize = 16; @@ -418,8 +416,11 @@ where impl SuperBlock { /// 🔥 🔥 🔥 pub unsafe fn new() -> Self { - #[cfg(debug)] - assert!(MAX_HEIGHT <= ABS_MAX_HEIGHT); + #[allow(clippy::assertions_on_constants)] + { + #[cfg(any(test, debug_assertions))] + assert!(MAX_HEIGHT <= ABS_MAX_HEIGHT); + } let b: Box> = Branch::new(); let root = Ptr::from(b);