From 482b47f4ed786946acb324b60d9f7ae7dd8cc075 Mon Sep 17 00:00:00 2001 From: Mica White Date: Sat, 14 Mar 2026 21:33:50 -0400 Subject: Apply clippy restrictions --- src/collection/retry.rs | 53 ++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/collection/retry.rs') diff --git a/src/collection/retry.rs b/src/collection/retry.rs index 4a5df6e..b9ac530 100755 --- a/src/collection/retry.rs +++ b/src/collection/retry.rs @@ -154,36 +154,39 @@ unsafe impl RawLock for RetryingLockCollection { handle_unwind( || 'outer: loop { // safety: we have the thread key - locks[first_index.get()].raw_read(); - for (i, lock) in locks.iter().enumerate() { - if i == first_index.get() { - continue; - } - - // safety: we have the thread key - if lock.raw_try_read() { - locked.set(locked.get() + 1); - } else { - // safety: we already locked all of these - attempt_to_recover_reads_from_panic(&locks[0..i]); + unsafe { + locks[first_index.get()].raw_read(); - if first_index.get() >= i { - // safety: this is already locked and can't be unlocked - // by the previous loop - locks[first_index.get()].raw_unlock_read(); + for (i, lock) in locks.iter().enumerate() { + if i == first_index.get() { + continue; } - // these are no longer locked - locked.set(0); + // safety: we have the thread key + if lock.raw_try_read() { + locked.set(locked.get() + 1); + } else { + // safety: we already locked all of these + attempt_to_recover_reads_from_panic(&locks[0..i]); + + if first_index.get() >= i { + // safety: this is already locked and can't be unlocked + // by the previous loop + locks[first_index.get()].raw_unlock_read(); + } + + // these are no longer locked + locked.set(0); - // don't go into a spin loop, wait for this one to lock - first_index.set(i); - continue 'outer; + // don't go into a spin loop, wait for this one to lock + first_index.set(i); + continue 'outer; + } } - } - // safety: we locked all the data - break; + // safety: we locked all the data + break; + } }, || { utils::attempt_to_recover_reads_from_panic(&locks[0..locked.get()]); @@ -1019,7 +1022,7 @@ mod tests { } #[test] - #[allow(clippy::float_cmp)] + #[expect(clippy::float_cmp)] fn uses_correct_default() { let collection = RetryingLockCollection::<(RwLock, Mutex>, Mutex)>::default(); -- cgit v1.2.3