Merge pull request #272 from cramertj/must-use

Set Future types as must_use
This commit is contained in:
Alex Crichton
2017-10-27 12:19:21 -04:00
committed by GitHub
14 changed files with 18 additions and 0 deletions
+3
View File
@@ -25,6 +25,7 @@ pub struct TcpListener {
/// Stream returned by the `TcpListener::incoming` function representing the
/// stream of sockets received from a listener.
#[must_use = "streams do nothing unless polled"]
pub struct Incoming {
inner: TcpListener,
}
@@ -235,10 +236,12 @@ pub struct TcpStream {
/// Future returned by `TcpStream::connect` which will resolve to a `TcpStream`
/// when the stream is connected.
#[must_use = "futures do nothing unless polled"]
pub struct TcpStreamNew {
inner: TcpStreamNewState,
}
#[must_use = "futures do nothing unless polled"]
enum TcpStreamNewState {
Waiting(TcpStream),
Error(io::Error),
+1
View File
@@ -55,6 +55,7 @@ pub trait UdpCodec {
///
/// You can acquire a `UdpFramed` instance by using the `UdpSocket::framed`
/// adapter.
#[must_use = "sinks do nothing unless polled"]
pub struct UdpFramed<C> {
socket: UdpSocket,
codec: C,
+2
View File
@@ -394,6 +394,7 @@ impl fmt::Debug for UdpSocket {
/// A future used to write the entire contents of some data to a UDP socket.
///
/// This is created by the `UdpSocket::send_dgram` method.
#[must_use = "futures do nothing unless polled"]
pub struct SendDgram<T> {
state: SendState<T>,
}
@@ -441,6 +442,7 @@ impl<T> Future for SendDgram<T>
/// A future used to receive a datagram from a UDP socket.
///
/// This is created by the `UdpSocket::recv_dgram` method.
#[must_use = "futures do nothing unless polled"]
pub struct RecvDgram<T> {
state: RecvState<T>,
}