Skip to content

Commit

Permalink
Remove #![allow(unused)]
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Aug 28, 2019
1 parent f43dcbd commit b4e746a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions futures-util/src/lock/bilock.rs
@@ -1,11 +1,9 @@
//! Futures-powered synchronization primitives.
#![allow(unused)]

use futures_core::future::Future;
use futures_core::task::{Context, Poll, Waker};
use core::cell::UnsafeCell;
use core::fmt;
use core::mem;
use core::ops::{Deref, DerefMut};
use core::pin::Pin;
use core::sync::atomic::AtomicUsize;
Expand Down Expand Up @@ -143,6 +141,7 @@ impl<T> BiLock<T> {
/// `BiLockGuard<T>`.
///
/// Note that the returned future will never resolve to an error.
#[cfg(feature = "bilock")]
pub fn lock(&self) -> BiLockAcquire<'_, T> {
BiLockAcquire {
bilock: self,
Expand All @@ -152,6 +151,7 @@ impl<T> BiLock<T> {
/// Attempts to put the two "halves" of a `BiLock<T>` back together and
/// recover the original value. Succeeds only if the two `BiLock<T>`s
/// originated from the same call to `BiLock::new`.
#[cfg(any(feature = "bilock", feature = "sink"))]
pub fn reunite(self, other: Self) -> Result<T, ReuniteError<T>>
where
T: Unpin,
Expand Down Expand Up @@ -185,6 +185,7 @@ impl<T> BiLock<T> {
}
}

#[cfg(any(feature = "bilock", feature = "sink"))]
impl<T: Unpin> Inner<T> {
unsafe fn into_value(mut self) -> T {
self.value.take().unwrap().into_inner()
Expand Down Expand Up @@ -258,15 +259,18 @@ impl<T> Drop for BiLockGuard<'_, T> {

/// Future returned by `BiLock::lock` which will resolve when the lock is
/// acquired.
#[cfg(feature = "bilock")]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub struct BiLockAcquire<'a, T> {
bilock: &'a BiLock<T>,
}

// Pinning is never projected to fields
#[cfg(feature = "bilock")]
impl<T> Unpin for BiLockAcquire<'_, T> {}

#[cfg(feature = "bilock")]
impl<'a, T> Future for BiLockAcquire<'a, T> {
type Output = BiLockGuard<'a, T>;

Expand Down

0 comments on commit b4e746a

Please sign in to comment.