diff options
| author | Mica White <botahamec@outlook.com> | 2026-09-13 15:12:08 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-09-13 15:12:08 -0400 |
| commit | 16d6bd7ece4c4b9b72f6bd51c9b034270b745525 (patch) | |
| tree | 4ff744fc41319ce73abe06416fabeaa7c17fbd46 /src/rwlock/rwlock.rs | |
| parent | 9fd7b94cd7c20abe66cea875a0e83e76a7a00fbc (diff) | |
Support no_stdno-std
Diffstat (limited to 'src/rwlock/rwlock.rs')
| -rwxr-xr-x | src/rwlock/rwlock.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/rwlock/rwlock.rs b/src/rwlock/rwlock.rs index 6adf73a..72e7742 100755 --- a/src/rwlock/rwlock.rs +++ b/src/rwlock/rwlock.rs @@ -1,8 +1,9 @@ -use std::cell::UnsafeCell; -use std::fmt::Debug; -use std::marker::PhantomData; -use std::panic::AssertUnwindSafe; +use core::cell::UnsafeCell; +use core::fmt::Debug; +use core::marker::PhantomData; +use core::panic::AssertUnwindSafe; +use alloc::vec::Vec; use lock_api::RawRwLock; use crate::handle_unwind::handle_unwind; @@ -163,7 +164,7 @@ impl<T, R: RawRwLock> RwLock<T, R> { #[mutants::skip] #[cfg(not(tarpaulin_include))] impl<T: Debug, R: RawRwLock> Debug for RwLock<T, R> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { // safety: this is just a try lock, and the value is dropped // immediately after, so there's no risk of blocking ourselves // or any other threads @@ -172,7 +173,7 @@ impl<T: Debug, R: RawRwLock> Debug for RwLock<T, R> { } else { struct LockedPlaceholder; impl Debug for LockedPlaceholder { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.write_str("<locked>") } } @@ -586,6 +587,8 @@ impl<T: ?Sized, R: RawRwLock> RwLock<T, R> { /// Attempts to create an exclusive lock without a key. Locking this /// without exclusive access to the key is undefined behavior. #[cfg(test)] + #[allow(clippy::allow_attributes)] + #[allow(dead_code)] pub(crate) unsafe fn try_write_no_key(&self) -> Option<RwLockWriteRef<'_, T, R>> { unsafe { if self.raw_try_write() { |
