summaryrefslogtreecommitdiff
path: root/src/mutex
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2025-02-05 20:31:00 -0500
committerBotahamec <botahamec@outlook.com>2025-02-05 20:31:00 -0500
commitf6b38f7425a3183214dae79445446b042154688f (patch)
tree1219d7cc4420ff4ad58a017c0f5861b7a2936f3b /src/mutex
parent280a61ad7b74019c7aad8b7306a0dd7cfb11359c (diff)
Tests and optimization
Diffstat (limited to 'src/mutex')
-rw-r--r--src/mutex/guard.rs8
-rw-r--r--src/mutex/mutex.rs1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/mutex/guard.rs b/src/mutex/guard.rs
index f7a01a4..4e4d5f1 100644
--- a/src/mutex/guard.rs
+++ b/src/mutex/guard.rs
@@ -34,6 +34,7 @@ impl<T: Ord + ?Sized, R: RawMutex> Ord for MutexRef<'_, T, R> {
}
#[mutants::skip] // hashing involves RNG and is hard to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawMutex> Hash for MutexRef<'_, T, R> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state)
@@ -41,6 +42,7 @@ impl<T: Hash + ?Sized, R: RawMutex> Hash for MutexRef<'_, T, R> {
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, R: RawMutex> Debug for MutexRef<'_, T, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
@@ -106,6 +108,7 @@ impl<'a, T: ?Sized, R: RawMutex> MutexRef<'a, T, R> {
// there's nothing i can do about that
#[mutants::skip] // it's hard to get two guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialEq + ?Sized, R: RawMutex, Key: Keyable> PartialEq for MutexGuard<'_, '_, T, Key, R> {
fn eq(&self, other: &Self) -> bool {
self.deref().eq(&**other)
@@ -113,9 +116,11 @@ impl<T: PartialEq + ?Sized, R: RawMutex, Key: Keyable> PartialEq for MutexGuard<
}
#[mutants::skip] // it's hard to get two guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Eq + ?Sized, R: RawMutex, Key: Keyable> Eq for MutexGuard<'_, '_, T, Key, R> {}
#[mutants::skip] // it's hard to get two guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialOrd + ?Sized, R: RawMutex, Key: Keyable> PartialOrd
for MutexGuard<'_, '_, T, Key, R>
{
@@ -125,6 +130,7 @@ impl<T: PartialOrd + ?Sized, R: RawMutex, Key: Keyable> PartialOrd
}
#[mutants::skip] // it's hard to get two guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Ord + ?Sized, R: RawMutex, Key: Keyable> Ord for MutexGuard<'_, '_, T, Key, R> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.deref().cmp(&**other)
@@ -132,6 +138,7 @@ impl<T: Ord + ?Sized, R: RawMutex, Key: Keyable> Ord for MutexGuard<'_, '_, T, K
}
#[mutants::skip] // hashing involves RNG and is hard to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawMutex, Key: Keyable> Hash for MutexGuard<'_, '_, T, Key, R> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state)
@@ -139,6 +146,7 @@ impl<T: Hash + ?Sized, R: RawMutex, Key: Keyable> Hash for MutexGuard<'_, '_, T,
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, Key: Keyable, R: RawMutex> Debug for MutexGuard<'_, '_, T, Key, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
diff --git a/src/mutex/mutex.rs b/src/mutex/mutex.rs
index 5b838a2..0bd5286 100644
--- a/src/mutex/mutex.rs
+++ b/src/mutex/mutex.rs
@@ -130,6 +130,7 @@ impl<T, R: RawMutex> Mutex<T, R> {
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: ?Sized + Debug, R: RawMutex> Debug for Mutex<T, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// safety: this is just a try lock, and the value is dropped