summaryrefslogtreecommitdiff
path: root/src/rwlock/rwlock.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rwlock/rwlock.rs')
-rwxr-xr-xsrc/rwlock/rwlock.rs15
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() {