Skip to content

Commit 75ef1db

Browse files
committed
Update #[must_use] message of impl Future types
Refs: rust-lang/rust#60808
1 parent 5ab4a42 commit 75ef1db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+69
-69
lines changed

futures-channel/src/oneshot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::lock::Lock;
1414
/// A future for a value that will be provided by another asynchronous task.
1515
///
1616
/// This is created by the [`channel`] function.
17-
#[must_use = "futures do nothing unless polled"]
17+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1818
#[derive(Debug)]
1919
pub struct Receiver<T> {
2020
inner: Arc<Inner<T>>,

futures-test/src/future/assert_unmoved.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::thread::panicking;
1010
/// [`FutureTestExt::assert_unmoved`](super::FutureTestExt::assert_unmoved)
1111
/// method.
1212
#[derive(Debug, Clone)]
13-
#[must_use = "futures do nothing unless polled"]
13+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1414
pub struct AssertUnmoved<Fut> {
1515
future: Fut,
1616
this_ptr: *const AssertUnmoved<Fut>,

futures-test/src/future/pending_once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
1010
/// [`FutureTestExt::pending_once`](super::FutureTestExt::pending_once)
1111
/// method.
1212
#[derive(Debug, Clone)]
13-
#[must_use = "futures do nothing unless polled"]
13+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1414
pub struct PendingOnce<Fut: Future> {
1515
future: Fut,
1616
polled_before: bool,

futures-util/src/compat/compat01as03.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use io::{AsyncRead01CompatExt, AsyncWrite01CompatExt};
1717
/// Converts a futures 0.1 Future, Stream, AsyncRead, or AsyncWrite
1818
/// object to a futures 0.3-compatible version,
1919
#[derive(Debug)]
20-
#[must_use = "futures do nothing unless polled"]
20+
#[must_use = "futures do nothing unless you `.await` or poll them"]
2121
pub struct Compat01As03<T> {
2222
pub(crate) inner: Spawn01<T>,
2323
}

futures-util/src/compat/compat03as01.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::{
2929
/// [`Stream`](futures::stream::Stream) or
3030
/// [`Sink`](futures::sink::Sink).
3131
#[derive(Debug, Clone, Copy)]
32-
#[must_use = "futures do nothing unless polled"]
32+
#[must_use = "futures do nothing unless you `.await` or poll them"]
3333
pub struct Compat<T> {
3434
pub(crate) inner: T,
3535
}

futures-util/src/future/abortable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use alloc::sync::Arc;
88

99
/// A future which can be remotely short-circuited using an `AbortHandle`.
1010
#[derive(Debug, Clone)]
11-
#[must_use = "futures do nothing unless polled"]
11+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1212
pub struct Abortable<Fut> {
1313
future: Fut,
1414
inner: Arc<AbortInner>,

futures-util/src/future/catch_unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::prelude::v1::*;
88

99
/// Future for the [`catch_unwind`](super::FutureExt::catch_unwind) method.
1010
#[derive(Debug)]
11-
#[must_use = "futures do nothing unless polled"]
11+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1212
pub struct CatchUnwind<Fut> where Fut: Future {
1313
future: Fut,
1414
}

futures-util/src/future/chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::pin::Pin;
22
use futures_core::future::Future;
33
use futures_core::task::{Context, Poll};
44

5-
#[must_use = "futures do nothing unless polled"]
5+
#[must_use = "futures do nothing unless you `.await` or poll them"]
66
#[derive(Debug)]
77
pub(crate) enum Chain<Fut1, Fut2, Data> {
88
First(Fut1, Option<Data>),

futures-util/src/future/empty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use futures_core::task::{Context, Poll};
55

66
/// Future for the [`empty`] function.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct Empty<T> {
1010
_data: marker::PhantomData<T>,
1111
}

futures-util/src/future/flatten.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures_core::task::{Context, Poll};
66
use pin_utils::unsafe_pinned;
77

88
/// Future for the [`flatten`](super::FutureExt::flatten) method.
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Flatten<Fut>
1111
where Fut: Future,
1212
Fut::Output: Future,

futures-util/src/future/fuse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;
55

66
/// Future for the [`fuse`](super::FutureExt::fuse) method.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct Fuse<Fut: Future> {
1010
future: Option<Fut>,
1111
}

futures-util/src/future/inspect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
55

66
/// Future for the [`inspect`](super::FutureExt::inspect) method.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct Inspect<Fut, F> where Fut: Future {
1010
future: Fut,
1111
f: Option<F>,

futures-util/src/future/join.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ macro_rules! generate {
1414
($Join:ident, <$($Fut:ident),*>),
1515
)*) => ($(
1616
$(#[$doc])*
17-
#[must_use = "futures do nothing unless polled"]
17+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1818
pub struct $Join<$($Fut: Future),*> {
1919
$($Fut: MaybeDone<$Fut>,)*
2020
}

futures-util/src/future/join_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn iter_pin_mut<T>(slice: Pin<&mut [T]>) -> impl Iterator<Item = Pin<&mut T>> {
5757
}
5858

5959
/// Future for the [`join_all`] function.
60-
#[must_use = "futures do nothing unless polled"]
60+
#[must_use = "futures do nothing unless you `.await` or poll them"]
6161
pub struct JoinAll<F>
6262
where
6363
F: Future,

futures-util/src/future/lazy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};
44

55
/// Future for the [`lazy`] function.
66
#[derive(Debug)]
7-
#[must_use = "futures do nothing unless polled"]
7+
#[must_use = "futures do nothing unless you `.await` or poll them"]
88
pub struct Lazy<F> {
99
f: Option<F>
1010
}

futures-util/src/future/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
55

66
/// Future for the [`map`](super::FutureExt::map) method.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct Map<Fut, F> {
1010
future: Fut,
1111
f: Option<F>,

futures-util/src/future/never_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;
55

66
/// Future for the [`never_error`](super::FutureExt::never_error) combinator.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct NeverError<Fut> {
1010
future: Fut,
1111
}

futures-util/src/future/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use pin_utils::unsafe_pinned;
2424
/// # });
2525
/// ```
2626
#[derive(Debug, Clone)]
27-
#[must_use = "futures do nothing unless polled"]
27+
#[must_use = "futures do nothing unless you `.await` or poll them"]
2828
pub struct OptionFuture<F> {
2929
option: Option<F>,
3030
}

futures-util/src/future/poll_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures_core::task::{Context, Poll};
66

77
/// Future for the [`poll_fn`] function.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct PollFn<F> {
1111
f: F,
1212
}

futures-util/src/future/ready.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};
44

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

1010
impl<T> Unpin for Ready<T> {}

futures-util/src/future/remote_handle.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use {
2121

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

5656
/// A future which sends its output to the corresponding `RemoteHandle`.
5757
/// Created by [`remote_handle`](crate::future::FutureExt::remote_handle).
58-
#[must_use = "futures do nothing unless polled"]
58+
#[must_use = "futures do nothing unless you `.await` or poll them"]
5959
pub struct Remote<Fut: Future> {
6060
tx: Option<Sender<SendMsg<Fut>>>,
6161
keep_running: Arc<AtomicBool>,

futures-util/src/future/select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use futures_core::task::{Context, Poll};
44
use crate::future::Either;
55

66
/// Future for the [`select()`] function.
7-
#[must_use = "futures do nothing unless polled"]
7+
#[must_use = "futures do nothing unless you `.await` or poll them"]
88
#[derive(Debug)]
99
pub struct Select<A: Unpin, B: Unpin> {
1010
inner: Option<(A, B)>,

futures-util/src/future/select_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use futures_core::task::{Context, Poll};
77

88
/// Future for the [`select_all`] function.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct SelectAll<Fut> {
1212
inner: Vec<Fut>,
1313
}

futures-util/src/future/shared.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::sync::atomic::Ordering::SeqCst;
1010
use std::sync::{Arc, Mutex};
1111

1212
/// Future for the [`shared`](super::FutureExt::shared) method.
13-
#[must_use = "futures do nothing unless polled"]
13+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1414
pub struct Shared<Fut: Future> {
1515
inner: Option<Arc<Inner<Fut>>>,
1616
waker_key: usize,

futures-util/src/future/then.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use pin_utils::unsafe_pinned;
66

77
/// Future for the [`then`](super::FutureExt::then) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Then<Fut1, Fut2, F> {
1111
chain: Chain<Fut1, Fut2, F>,
1212
}

futures-util/src/future/unit_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pin_utils::unsafe_pinned;
55

66
/// Future for the [`unit_error`](super::FutureExt::unit_error) combinator.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct UnitError<Fut> {
1010
future: Fut,
1111
}

futures-util/src/io/close.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::pin::Pin;
66

77
/// Future for the [`close`](super::AsyncWriteExt::close) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Close<'a, W: ?Sized + Unpin> {
1111
writer: &'a mut W,
1212
}

futures-util/src/io/copy_into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::pin::Pin;
77

88
/// Future for the [`copy_into`](super::AsyncReadExt::copy_into) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct CopyInto<'a, R: ?Sized + Unpin, W: ?Sized + Unpin> {
1212
reader: &'a mut R,
1313
read_done: bool,

futures-util/src/io/flush.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::pin::Pin;
66

77
/// Future for the [`flush`](super::AsyncWriteExt::flush) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Flush<'a, W: ?Sized + Unpin> {
1111
writer: &'a mut W,
1212
}

futures-util/src/io/read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::pin::Pin;
66

77
/// Future for the [`read`](super::AsyncReadExt::read) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Read<'a, R: ?Sized + Unpin> {
1111
reader: &'a mut R,
1212
buf: &'a mut [u8],

futures-util/src/io/read_exact.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::pin::Pin;
77

88
/// Future for the [`read_exact`](super::AsyncReadExt::read_exact) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct ReadExact<'a, R: ?Sized + Unpin> {
1212
reader: &'a mut R,
1313
buf: &'a mut [u8],

futures-util/src/io/read_line.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::read_until::read_until_internal;
99

1010
/// Future for the [`read_line`](super::AsyncBufReadExt::read_line) method.
1111
#[derive(Debug)]
12-
#[must_use = "futures do nothing unless polled"]
12+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1313
pub struct ReadLine<'a, R: ?Sized + Unpin> {
1414
reader: &'a mut R,
1515
buf: &'a mut String,

futures-util/src/io/read_to_end.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::vec::Vec;
77

88
/// Future for the [`read_to_end`](super::AsyncReadExt::read_to_end) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct ReadToEnd<'a, R: ?Sized + Unpin> {
1212
reader: &'a mut R,
1313
buf: &'a mut Vec<u8>,

futures-util/src/io/read_until.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::pin::Pin;
77

88
/// Future for the [`read_until`](super::AsyncBufReadExt::read_until) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct ReadUntil<'a, R: ?Sized + Unpin> {
1212
reader: &'a mut R,
1313
byte: u8,

futures-util/src/io/seek.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::pin::Pin;
66

77
/// Future for the [`seek`](crate::io::AsyncSeekExt::seek) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Seek<'a, S: ?Sized + Unpin> {
1111
seek: &'a mut S,
1212
pos: SeekFrom,

futures-util/src/io/write_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::pin::Pin;
77

88
/// Future for the [`write_all`](super::AsyncWriteExt::write_all) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct WriteAll<'a, W: ?Sized + Unpin> {
1212
writer: &'a mut W,
1313
buf: &'a [u8],

futures-util/src/lock/bilock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<T> Drop for BiLockGuard<'_, T> {
259259

260260
/// Future returned by `BiLock::lock` which will resolve when the lock is
261261
/// acquired.
262-
#[must_use = "futures do nothing unless polled"]
262+
#[must_use = "futures do nothing unless you `.await` or poll them"]
263263
#[derive(Debug)]
264264
pub struct BiLockAcquire<'a, T> {
265265
bilock: &'a BiLock<T>,

futures-util/src/sink/close.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures_sink::Sink;
66

77
/// Future for the [`close`](super::SinkExt::close) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Close<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
1111
sink: &'a mut Si,
1212
_phantom: PhantomData<fn(Item)>,

futures-util/src/sink/flush.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures_sink::Sink;
66

77
/// Future for the [`flush`](super::SinkExt::flush) method.
88
#[derive(Debug)]
9-
#[must_use = "futures do nothing unless polled"]
9+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1010
pub struct Flush<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
1111
sink: &'a mut Si,
1212
_phantom: PhantomData<fn(Item)>,

futures-util/src/sink/send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use futures_sink::Sink;
55

66
/// Future for the [`send`](super::SinkExt::send) method.
77
#[derive(Debug)]
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "futures do nothing unless you `.await` or poll them"]
99
pub struct Send<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {
1010
sink: &'a mut Si,
1111
item: Option<Item>,

futures-util/src/sink/send_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use futures_sink::Sink;
77

88
/// Future for the [`send_all`](super::SinkExt::send_all) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct SendAll<'a, Si, St>
1212
where
1313
Si: Sink<St::Item> + Unpin + ?Sized,

futures-util/src/stream/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
77

88
/// Future for the [`collect`](super::StreamExt::collect) method.
99
#[derive(Debug)]
10-
#[must_use = "futures do nothing unless polled"]
10+
#[must_use = "futures do nothing unless you `.await` or poll them"]
1111
pub struct Collect<St, C> {
1212
stream: St,
1313
collection: C,

futures-util/src/stream/concat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use futures_core::task::{Context, Poll};
77
use pin_utils::{unsafe_pinned, unsafe_unpinned};
88

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

0 commit comments

Comments
 (0)