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/rwlock/rwlock.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/rwlock/rwlock.rs') diff --git a/src/rwlock/rwlock.rs b/src/rwlock/rwlock.rs index b93d8e2..6adf73a 100755 --- a/src/rwlock/rwlock.rs +++ b/src/rwlock/rwlock.rs @@ -573,11 +573,13 @@ impl RwLock { /// Attempts to create a shared lock without a key. Locking this without /// exclusive access to the key is undefined behavior. pub(crate) unsafe fn try_read_no_key(&self) -> Option> { - if self.raw_try_read() { - // safety: the lock is locked first - Some(RwLockReadRef(self, PhantomData)) - } else { - None + unsafe { + if self.raw_try_read() { + // safety: the lock is locked first + Some(RwLockReadRef(self, PhantomData)) + } else { + None + } } } @@ -585,11 +587,13 @@ impl RwLock { /// without exclusive access to the key is undefined behavior. #[cfg(test)] pub(crate) unsafe fn try_write_no_key(&self) -> Option> { - if self.raw_try_write() { - // safety: the lock is locked first - Some(RwLockWriteRef(self, PhantomData)) - } else { - None + unsafe { + if self.raw_try_write() { + // safety: the lock is locked first + Some(RwLockWriteRef(self, PhantomData)) + } else { + None + } } } -- cgit v1.2.3