Skip to content

Commit

Permalink
Update #[must_use] message of impl Future types
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored and cramertj committed May 14, 2019
1 parent 5884327 commit ded685d
Show file tree
Hide file tree
Showing 68 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion futures-channel/src/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::lock::Lock;
/// A future for a value that will be provided by another asynchronous task.
///
/// This is created by the [`channel`] function.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub struct Receiver<T> {
inner: Arc<Inner<T>>,
Expand Down
2 changes: 1 addition & 1 deletion futures-test/src/future/assert_unmoved.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::thread::panicking;
/// [`FutureTestExt::assert_unmoved`](super::FutureTestExt::assert_unmoved)
/// method.
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct AssertUnmoved<Fut> {
future: Fut,
this_ptr: *const AssertUnmoved<Fut>,
Expand Down
2 changes: 1 addition & 1 deletion futures-test/src/future/pending_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
/// [`FutureTestExt::pending_once`](super::FutureTestExt::pending_once)
/// method.
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct PendingOnce<Fut: Future> {
future: Fut,
polled_before: bool,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/compat/compat01as03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use io::{AsyncRead01CompatExt, AsyncWrite01CompatExt};
/// Converts a futures 0.1 Future, Stream, AsyncRead, or AsyncWrite
/// object to a futures 0.3-compatible version,
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Compat01As03<T> {
pub(crate) inner: Spawn01<T>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/compat/compat03as01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::{
/// [`Stream`](futures::stream::Stream) or
/// [`Sink`](futures::sink::Sink).
#[derive(Debug, Clone, Copy)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Compat<T> {
pub(crate) inner: T,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/abortable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use alloc::sync::Arc;

/// A future which can be remotely short-circuited using an `AbortHandle`.
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Abortable<Fut> {
future: Fut,
inner: Arc<AbortInner>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/catch_unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::prelude::v1::*;

/// Future for the [`catch_unwind`](super::FutureExt::catch_unwind) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct CatchUnwind<Fut> where Fut: Future {
future: Fut,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::pin::Pin;
use futures_core::future::Future;
use futures_core::task::{Context, Poll};

#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub(crate) enum Chain<Fut1, Fut2, Data> {
First(Fut1, Option<Data>),
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures_core::task::{Context, Poll};

/// Future for the [`empty`] function.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Empty<T> {
_data: marker::PhantomData<T>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures_core::task::{Context, Poll};
use pin_utils::unsafe_pinned;

/// Future for the [`flatten`](super::FutureExt::flatten) method.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Flatten<Fut>
where Fut: Future,
Fut::Output: Future,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/fuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;

/// Future for the [`fuse`](super::FutureExt::fuse) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Fuse<Fut: Future> {
future: Option<Fut>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};

/// Future for the [`inspect`](super::FutureExt::inspect) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Inspect<Fut, F> where Fut: Future {
future: Fut,
f: Option<F>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! generate {
($Join:ident, <$($Fut:ident),*>),
)*) => ($(
$(#[$doc])*
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct $Join<$($Fut: Future),*> {
$($Fut: MaybeDone<$Fut>,)*
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/join_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn iter_pin_mut<T>(slice: Pin<&mut [T]>) -> impl Iterator<Item = Pin<&mut T>> {
}

/// Future for the [`join_all`] function.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct JoinAll<F>
where
F: Future,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};

/// Future for the [`lazy`] function.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Lazy<F> {
f: Option<F>
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};

/// Future for the [`map`](super::FutureExt::map) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Map<Fut, F> {
future: Fut,
f: Option<F>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/never_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;

/// Future for the [`never_error`](super::FutureExt::never_error) combinator.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct NeverError<Fut> {
future: Fut,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use pin_utils::unsafe_pinned;
/// # });
/// ```
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct OptionFuture<F> {
option: Option<F>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/poll_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures_core::task::{Context, Poll};

/// Future for the [`poll_fn`] function.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct PollFn<F> {
f: F,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/ready.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};

/// Future for the [`ready`](ready()) function.
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Ready<T>(Option<T>);

impl<T> Unpin for Ready<T> {}
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/future/remote_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use {

/// The handle to a remote future returned by
/// [`remote_handle`](crate::future::FutureExt::remote_handle).
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub struct RemoteHandle<T> {
rx: Receiver<thread::Result<T>>,
Expand Down Expand Up @@ -55,7 +55,7 @@ type SendMsg<Fut> = Result<<Fut as Future>::Output, Box<(dyn Any + Send + 'stati

/// A future which sends its output to the corresponding `RemoteHandle`.
/// Created by [`remote_handle`](crate::future::FutureExt::remote_handle).
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Remote<Fut: Future> {
tx: Option<Sender<SendMsg<Fut>>>,
keep_running: Arc<AtomicBool>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};
use crate::future::Either;

/// Future for the [`select()`] function.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub struct Select<A: Unpin, B: Unpin> {
inner: Option<(A, B)>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/select_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures_core::task::{Context, Poll};

/// Future for the [`select_all`] function.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct SelectAll<Fut> {
inner: Vec<Fut>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::atomic::Ordering::SeqCst;
use std::sync::{Arc, Mutex};

/// Future for the [`shared`](super::FutureExt::shared) method.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Shared<Fut: Future> {
inner: Option<Arc<Inner<Fut>>>,
waker_key: usize,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use pin_utils::unsafe_pinned;

/// Future for the [`then`](super::FutureExt::then) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Then<Fut1, Fut2, F> {
chain: Chain<Fut1, Fut2, F>,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/future/unit_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;

/// Future for the [`unit_error`](super::FutureExt::unit_error) combinator.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct UnitError<Fut> {
future: Fut,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::pin::Pin;

/// Future for the [`close`](super::AsyncWriteExt::close) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Close<'a, W: ?Sized + Unpin> {
writer: &'a mut W,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/copy_into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::pin::Pin;

/// Future for the [`copy_into`](super::AsyncReadExt::copy_into) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct CopyInto<'a, R: ?Sized + Unpin, W: ?Sized + Unpin> {
reader: &'a mut R,
read_done: bool,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::pin::Pin;

/// Future for the [`flush`](super::AsyncWriteExt::flush) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Flush<'a, W: ?Sized + Unpin> {
writer: &'a mut W,
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::pin::Pin;

/// Future for the [`read`](super::AsyncReadExt::read) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Read<'a, R: ?Sized + Unpin> {
reader: &'a mut R,
buf: &'a mut [u8],
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/read_exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::pin::Pin;

/// Future for the [`read_exact`](super::AsyncReadExt::read_exact) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct ReadExact<'a, R: ?Sized + Unpin> {
reader: &'a mut R,
buf: &'a mut [u8],
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/read_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::read_until::read_until_internal;

/// Future for the [`read_line`](super::AsyncBufReadExt::read_line) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct ReadLine<'a, R: ?Sized + Unpin> {
reader: &'a mut R,
buf: &'a mut String,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/read_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::vec::Vec;

/// Future for the [`read_to_end`](super::AsyncReadExt::read_to_end) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct ReadToEnd<'a, R: ?Sized + Unpin> {
reader: &'a mut R,
buf: &'a mut Vec<u8>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/read_until.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::pin::Pin;

/// Future for the [`read_until`](super::AsyncBufReadExt::read_until) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct ReadUntil<'a, R: ?Sized + Unpin> {
reader: &'a mut R,
byte: u8,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::pin::Pin;

/// Future for the [`seek`](crate::io::AsyncSeekExt::seek) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Seek<'a, S: ?Sized + Unpin> {
seek: &'a mut S,
pos: SeekFrom,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/io/write_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::pin::Pin;

/// Future for the [`write_all`](super::AsyncWriteExt::write_all) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct WriteAll<'a, W: ?Sized + Unpin> {
writer: &'a mut W,
buf: &'a [u8],
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/lock/bilock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<T> Drop for BiLockGuard<'_, T> {

/// Future returned by `BiLock::lock` which will resolve when the lock is
/// acquired.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Debug)]
pub struct BiLockAcquire<'a, T> {
bilock: &'a BiLock<T>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/sink/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures_sink::Sink;

/// Future for the [`close`](super::SinkExt::close) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Close<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
sink: &'a mut Si,
_phantom: PhantomData<fn(Item)>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/sink/flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures_sink::Sink;

/// Future for the [`flush`](super::SinkExt::flush) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Flush<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
sink: &'a mut Si,
_phantom: PhantomData<fn(Item)>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/sink/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures_sink::Sink;

/// Future for the [`send`](super::SinkExt::send) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Send<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
sink: &'a mut Si,
item: Option<Item>,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/sink/send_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures_sink::Sink;

/// Future for the [`send_all`](super::SinkExt::send_all) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct SendAll<'a, Si, St>
where
Si: Sink<St::Item> + Unpin + ?Sized,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/stream/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};

/// Future for the [`collect`](super::StreamExt::collect) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Collect<St, C> {
stream: St,
collection: C,
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/stream/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures_core::task::{Context, Poll};
use pin_utils::{unsafe_pinned, unsafe_unpinned};

/// Future for the [`concat`](super::StreamExt::concat) method.
#[must_use = "futures do nothing unless polled"]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Concat<St: Stream> {
stream: St,
accum: Option<St::Item>,
Expand Down
Loading

0 comments on commit ded685d

Please sign in to comment.