diff options
Diffstat (limited to 'src/poisonable')
| -rw-r--r-- | src/poisonable/error.rs | 2 | ||||
| -rw-r--r-- | src/poisonable/flag.rs | 1 | ||||
| -rw-r--r-- | src/poisonable/guard.rs | 8 | ||||
| -rw-r--r-- | src/poisonable/poisonable.rs | 8 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/poisonable/error.rs b/src/poisonable/error.rs index d543294..9721ce4 100644 --- a/src/poisonable/error.rs +++ b/src/poisonable/error.rs @@ -3,6 +3,7 @@ use std::error::Error; use super::{PoisonError, PoisonGuard, TryLockPoisonableError}; +#[mutants::skip] impl<Guard> fmt::Debug for PoisonError<Guard> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("PoisonError").finish_non_exhaustive() @@ -149,6 +150,7 @@ impl<Guard> PoisonError<Guard> { } } +#[mutants::skip] impl<G, Key> fmt::Debug for TryLockPoisonableError<'_, '_, G, Key> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { diff --git a/src/poisonable/flag.rs b/src/poisonable/flag.rs index 7714f5f..6b567c8 100644 --- a/src/poisonable/flag.rs +++ b/src/poisonable/flag.rs @@ -28,6 +28,7 @@ impl PoisonFlag { Self() } + #[mutants::skip] // None of the tests have panic = "abort", so this can't be tested pub fn is_poisoned(&self) -> bool { false } diff --git a/src/poisonable/guard.rs b/src/poisonable/guard.rs index 97d1c60..36566f5 100644 --- a/src/poisonable/guard.rs +++ b/src/poisonable/guard.rs @@ -48,12 +48,14 @@ impl<Guard: Ord> Ord for PoisonRef<'_, Guard> { } } +#[mutants::skip] // hashing involves RNG and is hard to test impl<Guard: Hash> Hash for PoisonRef<'_, Guard> { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { self.guard.hash(state) } } +#[mutants::skip] impl<Guard: Debug> Debug for PoisonRef<'_, Guard> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Debug::fmt(&**self, f) @@ -92,32 +94,38 @@ impl<Guard> AsMut<Guard> for PoisonRef<'_, Guard> { } } +#[mutants::skip] // it's hard to get two guards safely impl<Guard: PartialEq, Key: Keyable> PartialEq for PoisonGuard<'_, '_, Guard, Key> { fn eq(&self, other: &Self) -> bool { self.guard.eq(&other.guard) } } +#[mutants::skip] // it's hard to get two guards safely impl<Guard: PartialOrd, Key: Keyable> PartialOrd for PoisonGuard<'_, '_, Guard, Key> { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { self.guard.partial_cmp(&other.guard) } } +#[mutants::skip] // it's hard to get two guards safely impl<Guard: Eq, Key: Keyable> Eq for PoisonGuard<'_, '_, Guard, Key> {} +#[mutants::skip] // it's hard to get two guards safely impl<Guard: Ord, Key: Keyable> Ord for PoisonGuard<'_, '_, Guard, Key> { fn cmp(&self, other: &Self) -> std::cmp::Ordering { self.guard.cmp(&other.guard) } } +#[mutants::skip] // hashing involves RNG and is hard to test impl<Guard: Hash, Key: Keyable> Hash for PoisonGuard<'_, '_, Guard, Key> { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { self.guard.hash(state) } } +#[mutants::skip] impl<Guard: Debug, Key: Keyable> Debug for PoisonGuard<'_, '_, Guard, Key> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Debug::fmt(&self.guard, f) diff --git a/src/poisonable/poisonable.rs b/src/poisonable/poisonable.rs index c6da89d..0bc2b03 100644 --- a/src/poisonable/poisonable.rs +++ b/src/poisonable/poisonable.rs @@ -56,9 +56,9 @@ unsafe impl<L: Lockable> Lockable for Poisonable<L> { let ref_guard = PoisonRef::new(&self.poisoned, self.inner.guard()); if self.is_poisoned() { - Ok(ref_guard) - } else { Err(PoisonError::new(ref_guard)) + } else { + Ok(ref_guard) } } } @@ -73,9 +73,9 @@ unsafe impl<L: Sharable> Sharable for Poisonable<L> { let ref_guard = PoisonRef::new(&self.poisoned, self.inner.read_guard()); if self.is_poisoned() { - Ok(ref_guard) - } else { Err(PoisonError::new(ref_guard)) + } else { + Ok(ref_guard) } } } |
