diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/collection/ref_collection.rs | 5 | ||||
| -rw-r--r-- | src/mutex.rs | 24 |
2 files changed, 2 insertions, 27 deletions
diff --git a/src/collection/ref_collection.rs b/src/collection/ref_collection.rs index 2462182..41f6b16 100644 --- a/src/collection/ref_collection.rs +++ b/src/collection/ref_collection.rs @@ -15,9 +15,8 @@ fn get_locks<L: Lockable>(data: &L) -> Vec<&dyn Lock> { /// returns `true` if the sorted list contains a duplicate #[must_use] fn contains_duplicates(l: &[&dyn Lock]) -> bool { - l.windows(2).any(|window| { - std::ptr::addr_eq(std::ptr::from_ref(window[0]), std::ptr::from_ref(window[1])) - }) + l.windows(2) + .any(|window| std::ptr::eq(window[0], window[1])) } impl<'a, L: Lockable> AsRef<L> for RefLockCollection<'a, L> { diff --git a/src/mutex.rs b/src/mutex.rs index cef338e..a3baa00 100644 --- a/src/mutex.rs +++ b/src/mutex.rs @@ -54,27 +54,3 @@ pub struct MutexGuard<'a, 'key: 'a, T: ?Sized + 'a, Key: Keyable + 'key, R: RawM thread_key: Key, _phantom: PhantomData<&'key ()>, } - -struct MutexLockFuture<'a, T: ?Sized + 'a, R: RawMutex> { - mutex: &'a Mutex<T, R>, - key: Option<crate::ThreadKey>, -} - -impl<'a, T: ?Sized + 'a, R: RawMutex> std::future::Future for MutexLockFuture<'a, T, R> { - type Output = MutexGuard<'a, 'a, T, crate::ThreadKey, R>; - - fn poll( - mut self: std::pin::Pin<&mut Self>, - cx: &mut std::task::Context<'_>, - ) -> std::task::Poll<Self::Output> { - match unsafe { self.mutex.try_lock_no_key() } { - Some(guard) => std::task::Poll::Ready(unsafe { - MutexGuard::new(guard.0, self.key.take().unwrap()) - }), - None => { - cx.waker().wake_by_ref(); - std::task::Poll::Pending - } - } - } -} |
