summaryrefslogtreecommitdiff
path: root/src/rwlock
diff options
context:
space:
mode:
Diffstat (limited to 'src/rwlock')
-rw-r--r--src/rwlock/read_guard.rs8
-rw-r--r--src/rwlock/read_lock.rs3
-rw-r--r--src/rwlock/rwlock.rs1
-rw-r--r--src/rwlock/write_guard.rs8
-rw-r--r--src/rwlock/write_lock.rs1
5 files changed, 20 insertions, 1 deletions
diff --git a/src/rwlock/read_guard.rs b/src/rwlock/read_guard.rs
index 2195e44..bd22837 100644
--- a/src/rwlock/read_guard.rs
+++ b/src/rwlock/read_guard.rs
@@ -34,6 +34,7 @@ impl<T: Ord + ?Sized, R: RawRwLock> Ord for RwLockReadRef<'_, T, R> {
}
#[mutants::skip] // hashing involves PRNG and is hard to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawRwLock> Hash for RwLockReadRef<'_, 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: RawRwLock> Hash for RwLockReadRef<'_, T, R> {
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, R: RawRwLock> Debug for RwLockReadRef<'_, T, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
@@ -88,6 +90,7 @@ impl<'a, T: ?Sized, R: RawRwLock> RwLockReadRef<'a, T, R> {
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialEq + ?Sized, R: RawRwLock, Key: Keyable> PartialEq
for RwLockReadGuard<'_, '_, T, Key, R>
{
@@ -97,9 +100,11 @@ impl<T: PartialEq + ?Sized, R: RawRwLock, Key: Keyable> PartialEq
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Eq + ?Sized, R: RawRwLock, Key: Keyable> Eq for RwLockReadGuard<'_, '_, T, Key, R> {}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialOrd + ?Sized, R: RawRwLock, Key: Keyable> PartialOrd
for RwLockReadGuard<'_, '_, T, Key, R>
{
@@ -109,6 +114,7 @@ impl<T: PartialOrd + ?Sized, R: RawRwLock, Key: Keyable> PartialOrd
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Ord + ?Sized, R: RawRwLock, Key: Keyable> Ord for RwLockReadGuard<'_, '_, T, Key, R> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.deref().cmp(&**other)
@@ -116,6 +122,7 @@ impl<T: Ord + ?Sized, R: RawRwLock, Key: Keyable> Ord for RwLockReadGuard<'_, '_
}
#[mutants::skip] // hashing involves PRNG and is hard to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawRwLock, Key: Keyable> Hash for RwLockReadGuard<'_, '_, T, Key, R> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state)
@@ -123,6 +130,7 @@ impl<T: Hash + ?Sized, R: RawRwLock, Key: Keyable> Hash for RwLockReadGuard<'_,
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, Key: Keyable, R: RawRwLock> Debug for RwLockReadGuard<'_, '_, T, Key, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
diff --git a/src/rwlock/read_lock.rs b/src/rwlock/read_lock.rs
index 5ac0bbb..5dd83a7 100644
--- a/src/rwlock/read_lock.rs
+++ b/src/rwlock/read_lock.rs
@@ -34,6 +34,7 @@ unsafe impl<T: Send, R: RawRwLock + Send + Sync> Sharable for ReadLock<'_, T, R>
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: ?Sized + Debug, R: RawRwLock> Debug for ReadLock<'_, 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
@@ -108,7 +109,7 @@ impl<T: ?Sized, R: RawRwLock> ReadLock<'_, T, R> {
/// use happylock::rwlock::ReadLock;
///
/// let key = ThreadKey::get().unwrap();
- /// let lock: &'static mut RwLock<_> = Box::leak(Box::new(RwLock::new(1)));
+ /// let lock: RwLock<_> = RwLock::new(1);
/// let reader = ReadLock::new(&lock);
///
/// let n = reader.lock(key);
diff --git a/src/rwlock/rwlock.rs b/src/rwlock/rwlock.rs
index 7a105d7..038e6c7 100644
--- a/src/rwlock/rwlock.rs
+++ b/src/rwlock/rwlock.rs
@@ -141,6 +141,7 @@ impl<T, R: RawRwLock> RwLock<T, R> {
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: ?Sized + Debug, R: RawRwLock> Debug for RwLock<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
diff --git a/src/rwlock/write_guard.rs b/src/rwlock/write_guard.rs
index ff559b8..c971260 100644
--- a/src/rwlock/write_guard.rs
+++ b/src/rwlock/write_guard.rs
@@ -34,6 +34,7 @@ impl<T: Ord + ?Sized, R: RawRwLock> Ord for RwLockWriteRef<'_, T, R> {
}
#[mutants::skip] // hashing involves PRNG and is difficult to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawRwLock> Hash for RwLockWriteRef<'_, 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: RawRwLock> Hash for RwLockWriteRef<'_, T, R> {
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, R: RawRwLock> Debug for RwLockWriteRef<'_, T, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
@@ -103,6 +105,7 @@ impl<'a, T: ?Sized + 'a, R: RawRwLock> RwLockWriteRef<'a, T, R> {
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialEq + ?Sized, R: RawRwLock, Key: Keyable> PartialEq
for RwLockWriteGuard<'_, '_, T, Key, R>
{
@@ -112,9 +115,11 @@ impl<T: PartialEq + ?Sized, R: RawRwLock, Key: Keyable> PartialEq
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Eq + ?Sized, R: RawRwLock, Key: Keyable> Eq for RwLockWriteGuard<'_, '_, T, Key, R> {}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: PartialOrd + ?Sized, R: RawRwLock, Key: Keyable> PartialOrd
for RwLockWriteGuard<'_, '_, T, Key, R>
{
@@ -124,6 +129,7 @@ impl<T: PartialOrd + ?Sized, R: RawRwLock, Key: Keyable> PartialOrd
}
#[mutants::skip] // it's hard to get two read guards safely
+#[cfg(not(tarpaulin_include))]
impl<T: Ord + ?Sized, R: RawRwLock, Key: Keyable> Ord for RwLockWriteGuard<'_, '_, T, Key, R> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.deref().cmp(&**other)
@@ -131,6 +137,7 @@ impl<T: Ord + ?Sized, R: RawRwLock, Key: Keyable> Ord for RwLockWriteGuard<'_, '
}
#[mutants::skip] // hashing involves PRNG and is difficult to test
+#[cfg(not(tarpaulin_include))]
impl<T: Hash + ?Sized, R: RawRwLock, Key: Keyable> Hash for RwLockWriteGuard<'_, '_, T, Key, R> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state)
@@ -138,6 +145,7 @@ impl<T: Hash + ?Sized, R: RawRwLock, Key: Keyable> Hash for RwLockWriteGuard<'_,
}
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: Debug + ?Sized, Key: Keyable, R: RawRwLock> Debug for RwLockWriteGuard<'_, '_, T, Key, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&**self, f)
diff --git a/src/rwlock/write_lock.rs b/src/rwlock/write_lock.rs
index 443fbcd..cc96953 100644
--- a/src/rwlock/write_lock.rs
+++ b/src/rwlock/write_lock.rs
@@ -26,6 +26,7 @@ unsafe impl<T: Send, R: RawRwLock + Send + Sync> Lockable for WriteLock<'_, T, R
// no way to express that. I don't think I want to ever express that.
#[mutants::skip]
+#[cfg(not(tarpaulin_include))]
impl<T: ?Sized + Debug, R: RawRwLock> Debug for WriteLock<'_, 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