summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-02-07 10:49:18 -0500
committerMica White <botahamec@outlook.com>2026-02-07 10:49:18 -0500
commitbf11d8039eb72a37e852f5b64c8ee1f241203878 (patch)
treea76a4ba9f2c14e580b6efc0ea7dabb1b81cc3d4e /src
parent2096d0c6819ce0e8f6c6e77e36ebc495924dad63 (diff)
Fix clippy warnings
Diffstat (limited to 'src')
-rwxr-xr-xsrc/collection/boxed.rs6
-rwxr-xr-xsrc/collection/ref.rs4
-rwxr-xr-xsrc/collection/retry.rs12
-rwxr-xr-xsrc/collection/utils.rs8
-rwxr-xr-xsrc/poisonable.rs2
5 files changed, 18 insertions, 14 deletions
diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs
index 3600d8e..85ec34f 100755
--- a/src/collection/boxed.rs
+++ b/src/collection/boxed.rs
@@ -207,7 +207,7 @@ impl<L> BoxedLockCollection<L> {
pub fn into_child(mut self) -> L {
unsafe {
// safety: this collection will never be used again
- std::ptr::drop_in_place(&mut self.locks);
+ std::ptr::drop_in_place(&raw mut self.locks);
// safety: this was allocated using a box, and is now unique
let boxed: Box<UnsafeCell<L>> = Box::from_raw(self.child.cast_mut());
// to prevent a double free
@@ -911,7 +911,7 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = BoxedLockCollection::new_ref(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, collection.as_ref()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, collection.as_ref()))
}
#[test]
@@ -919,6 +919,6 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = BoxedLockCollection::new_ref(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, *collection.child()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, *collection.child()))
}
}
diff --git a/src/collection/ref.rs b/src/collection/ref.rs
index 4ba06bd..14ad861 100755
--- a/src/collection/ref.rs
+++ b/src/collection/ref.rs
@@ -756,7 +756,7 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = RefLockCollection::new(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, collection.as_ref()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, collection.as_ref()))
}
#[test]
@@ -764,6 +764,6 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = RefLockCollection::new(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, collection.child()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, collection.child()))
}
}
diff --git a/src/collection/retry.rs b/src/collection/retry.rs
index 64e8ca8..c887405 100755
--- a/src/collection/retry.rs
+++ b/src/collection/retry.rs
@@ -1150,11 +1150,11 @@ mod tests {
let collection: RetryingLockCollection<[RwLock<i32>; 0]> = RetryingLockCollection::new([]);
let guard = collection.lock(key);
- assert!(guard.len() == 0);
+ assert!(guard.is_empty());
let key = RetryingLockCollection::<[RwLock<_>; 0]>::unlock(guard);
let guard = collection.read(key);
- assert!(guard.len() == 0);
+ assert!(guard.is_empty());
}
#[test]
@@ -1163,11 +1163,11 @@ mod tests {
let collection: RetryingLockCollection<[RwLock<i32>; 0]> = RetryingLockCollection::new([]);
let guard = collection.read(key);
- assert!(guard.len() == 0);
+ assert!(guard.is_empty());
let key = RetryingLockCollection::<[RwLock<_>; 0]>::unlock_read(guard);
let guard = collection.lock(key);
- assert!(guard.len() == 0);
+ assert!(guard.is_empty());
}
#[test]
@@ -1175,7 +1175,7 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = RetryingLockCollection::new_ref(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, collection.as_ref()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, collection.as_ref()))
}
#[test]
@@ -1193,7 +1193,7 @@ mod tests {
let mutexes = [Mutex::new(0), Mutex::new(1)];
let collection = RetryingLockCollection::new_ref(&mutexes);
- assert!(std::ptr::addr_eq(&mutexes, *collection.child()))
+ assert!(std::ptr::addr_eq(&raw const mutexes, *collection.child()))
}
#[test]
diff --git a/src/collection/utils.rs b/src/collection/utils.rs
index 71a023e..e79b78b 100755
--- a/src/collection/utils.rs
+++ b/src/collection/utils.rs
@@ -227,7 +227,9 @@ pub unsafe fn attempt_to_recover_writes_from_panic(locks: &[&dyn RawLock]) {
handle_unwind(
|| {
// safety: the caller assumes that these are already locked
- locks.iter().for_each(|lock| lock.raw_unlock_write());
+ for lock in locks {
+ lock.raw_unlock_write();
+ }
},
// if we get another panic in here, we'll just have to poison what remains
|| locks.iter().for_each(|l| l.poison()),
@@ -239,7 +241,9 @@ pub unsafe fn attempt_to_recover_reads_from_panic(locked: &[&dyn RawLock]) {
handle_unwind(
|| {
// safety: the caller assumes these are already locked
- locked.iter().for_each(|lock| lock.raw_unlock_read());
+ for lock in locked {
+ lock.raw_unlock_read();
+ }
},
// if we get another panic in here, we'll just have to poison what remains
|| locked.iter().for_each(|l| l.poison()),
diff --git a/src/poisonable.rs b/src/poisonable.rs
index 74444db..ac0e1bf 100755
--- a/src/poisonable.rs
+++ b/src/poisonable.rs
@@ -469,7 +469,7 @@ mod tests {
poisonable.get_ptrs(&mut lock_ptrs);
assert_eq!(lock_ptrs.len(), 1);
- assert!(std::ptr::addr_eq(lock_ptrs[0], &poisonable.inner));
+ assert!(std::ptr::addr_eq(lock_ptrs[0], &raw const poisonable.inner));
}
#[test]