diff --git a/rearch-effects/src/multi.rs b/rearch-effects/src/multi.rs index 5dc46cd..a4dd248 100644 --- a/rearch-effects/src/multi.rs +++ b/rearch-effects/src/multi.rs @@ -44,7 +44,10 @@ fn multi_impl(register: SideEffectRegistrar) -> MultiSideEf /// Allows you to register multiple side effects _sequentially_, /// unlike the standard [`SideEffectRegistrar`]. /// Provided by [`multi`]. -#[allow(clippy::module_name_repetitions)] // re-exported at crate level (not from module) +#[expect( + clippy::module_name_repetitions, + reason = "https://github.com/rust-lang/rust-clippy/issues/8524" +)] pub struct MultiSideEffectRegistrar<'a> { // NOTE: the Cells are needed in order to support register(&self) (versus &mut self) curr_index: Cell, diff --git a/rearch/src/lib.rs b/rearch/src/lib.rs index a66939e..1781f45 100644 --- a/rearch/src/lib.rs +++ b/rearch/src/lib.rs @@ -497,11 +497,7 @@ impl CapsuleManager { } #[cfg(test)] -#[allow( - clippy::unwrap_used, - clippy::too_many_lines, - clippy::cognitive_complexity -)] +#[allow(clippy::unwrap_used)] mod tests { use crate::*; @@ -745,12 +741,16 @@ mod tests { } #[test] + #[allow( + clippy::needless_pass_by_value, + clippy::too_many_lines, + clippy::cognitive_complexity + )] fn eq_check_skips_unneeded_rebuilds() { use std::{any::TypeId, collections::HashMap}; static BUILDS: Mutex>> = Mutex::new(OnceCell::new()); - #[allow(clippy::needless_pass_by_value)] fn increment_build_count(_capsule: C) { let mut cell = BUILDS.lock(); cell.get_or_init(HashMap::new); @@ -758,7 +758,7 @@ mod tests { *entry.or_default() += 1; drop(cell); } - #[allow(clippy::needless_pass_by_value)] + fn get_build_count(_capsule: C) -> u32 { *BUILDS .lock() @@ -975,6 +975,7 @@ mod tests { // // C, D, E, G, H are idempotent. A, B, F are not. #[test] + #[allow(clippy::cognitive_complexity)] fn complex_dependency_graph() { fn stateful_a(CapsuleHandle { register, .. }: CapsuleHandle) -> (u8, impl CData + Fn(u8)) { register.register(effects::cloned_state(0)) @@ -1032,28 +1033,28 @@ mod tests { let txn = container.0.read_txn(); assert!(txn.try_read(&stateful_a).is_some()); - assert_eq!(txn.try_read(&a).unwrap(), 0); - assert_eq!(txn.try_read(&b).unwrap(), 1); - assert_eq!(txn.try_read(&c).unwrap(), 2); - assert_eq!(txn.try_read(&d).unwrap(), 2); - assert_eq!(txn.try_read(&e).unwrap(), 1); - assert_eq!(txn.try_read(&f).unwrap(), 1); - assert_eq!(txn.try_read(&g).unwrap(), 3); - assert_eq!(txn.try_read(&h).unwrap(), 1); + assert_eq!(txn.try_read(&a), Some(0)); + assert_eq!(txn.try_read(&b), Some(1)); + assert_eq!(txn.try_read(&c), Some(2)); + assert_eq!(txn.try_read(&d), Some(2)); + assert_eq!(txn.try_read(&e), Some(1)); + assert_eq!(txn.try_read(&f), Some(1)); + assert_eq!(txn.try_read(&g), Some(3)); + assert_eq!(txn.try_read(&h), Some(1)); drop(txn); container.read(stateful_a).1(10); let txn = container.0.read_txn(); assert!(txn.try_read(&stateful_a).is_some()); - assert_eq!(txn.try_read(&a).unwrap(), 10); - assert_eq!(txn.try_read(&b).unwrap(), 11); + assert_eq!(txn.try_read(&a), Some(10)); + assert_eq!(txn.try_read(&b), Some(11)); assert_eq!(txn.try_read(&c), None); assert_eq!(txn.try_read(&d), None); - assert_eq!(txn.try_read(&e).unwrap(), 11); - assert_eq!(txn.try_read(&f).unwrap(), 11); + assert_eq!(txn.try_read(&e), Some(11)); + assert_eq!(txn.try_read(&f), Some(11)); assert_eq!(txn.try_read(&g), None); - assert_eq!(txn.try_read(&h).unwrap(), 1); + assert_eq!(txn.try_read(&h), Some(1)); drop(txn); } diff --git a/rearch/src/side_effect_registrar.rs b/rearch/src/side_effect_registrar.rs index 997d38e..96d20c2 100644 --- a/rearch/src/side_effect_registrar.rs +++ b/rearch/src/side_effect_registrar.rs @@ -39,7 +39,10 @@ impl<'a> SideEffectRegistrar<'a> { impl<'a> SideEffectRegistrar<'a> { /// The basic building block for all side effects. - #[allow(clippy::missing_panics_doc)] // false positive + /// + /// # Panics + /// Panics when the supplied type `T` changes between builds. + /// Ensure T remains the same across builds (e.g., by calling this function unconditionally). pub fn raw( self, initial: T, diff --git a/rearch/src/txn.rs b/rearch/src/txn.rs index f80faff..f5dc9b1 100644 --- a/rearch/src/txn.rs +++ b/rearch/src/txn.rs @@ -10,7 +10,10 @@ use crate::{ EXCLUSIVE_OWNER_MSG, }; -#[allow(clippy::module_name_repetitions)] // re-exported at crate level (not in module) +#[expect( + clippy::module_name_repetitions, + reason = "https://github.com/rust-lang/rust-clippy/issues/8524" +)] pub struct ContainerReadTxn<'a> { pub(crate) data: RwLockReadGuard<'a, HashMap>>, } @@ -40,7 +43,10 @@ impl ContainerReadTxn<'_> { } } -#[allow(clippy::module_name_repetitions)] // re-exported at crate level (not in module) +#[expect( + clippy::module_name_repetitions, + reason = "https://github.com/rust-lang/rust-clippy/issues/8524" +)] pub struct ContainerWriteTxn<'a> { pub(crate) side_effect_txn_orchestrator: SideEffectTxnOrchestrator, pub(crate) data: RwLockWriteGuard<'a, HashMap>>, @@ -78,7 +84,6 @@ impl ContainerWriteTxn<'_> { self.read_or_init_ref(capsule).clone() } - #[allow(clippy::missing_panics_doc)] // false positive pub fn read_or_init_ref(&mut self, capsule: C) -> &C::Data { let id = capsule.id(); self.ensure_initialized(capsule);