Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit 2e41ca0

Browse files
ibaryshnikovyoshuawuyts
authored andcommitted
improved error message for unused futures (#32)
1 parent 51e45c6 commit 2e41ca0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/net/tcp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl AsyncWrite for TcpStream {
217217
///
218218
/// [`TcpStream::connect`]: struct.TcpStream.html#method.connect
219219
/// [`TcpStream`]: struct.TcpStream.html
220-
#[must_use = "futures do nothing unless polled"]
220+
#[must_use = "futures do nothing unless you `.await` or poll them"]
221221
pub struct Connect {
222222
addrs: Option<io::Result<VecDeque<SocketAddr>>>,
223223
last_err: Option<io::Error>,
@@ -453,7 +453,7 @@ impl TcpListener {
453453
///
454454
/// [`TcpStream::accept`]: struct.TcpStream.html#method.accept
455455
/// [`TcpStream`]: struct.TcpStream.html
456-
#[must_use = "futures do nothing unless polled"]
456+
#[must_use = "futures do nothing unless you `.await` or poll them"]
457457
#[derive(Debug)]
458458
pub struct Accept<'stream> {
459459
inner: Incoming<'stream>,

src/net/udp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl UdpSocket {
358358
/// On success, returns the number of bytes written.
359359
///
360360
/// [`UdpSocket::send_to`]: struct.UdpSocket.html#method.send_to
361-
#[must_use = "futures do nothing unless polled"]
361+
#[must_use = "futures do nothing unless you `.await` or poll them"]
362362
#[derive(Debug)]
363363
pub struct SendTo<'socket, 'buf> {
364364
/// The open socket we use to send the message from.
@@ -393,7 +393,7 @@ impl<'socket, 'buf> Future for SendTo<'socket, 'buf> {
393393
/// On success, returns the number of bytes read and the origin.
394394
///
395395
/// [`UdpSocket::recv_from`]: struct.UdpSocket.html#method.recv_from
396-
#[must_use = "futures do nothing unless polled"]
396+
#[must_use = "futures do nothing unless you `.await` or poll them"]
397397
#[derive(Debug)]
398398
pub struct RecvFrom<'socket, 'buf> {
399399
socket: &'socket mut UdpSocket,

src/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ where
4545
/// A handle that awaits the result of a [`spawn`]ed future.
4646
///
4747
/// [`spawn`]: fn.spawn.html
48-
#[must_use = "futures do nothing unless polled"]
48+
#[must_use = "futures do nothing unless you `.await` or poll them"]
4949
#[derive(Debug)]
5050
pub struct JoinHandle<T> {
5151
pub(crate) rx: futures::channel::oneshot::Receiver<T>,

0 commit comments

Comments
 (0)