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

added #[must_use] for impl Future structs #31

Merged
merged 4 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/guessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn main() -> Result<(), failure::Error> {

let mut incoming = listener.incoming();
while let Some(stream) = incoming.next().await {
runtime::spawn(play(stream?));
runtime::spawn(play(stream?)).await?;
}
Ok(())
}
3 changes: 2 additions & 1 deletion examples/tcp-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ async fn main() -> std::io::Result<()> {
let (reader, writer) = &mut stream.split();
reader.copy_into(writer).await?;
Ok::<(), std::io::Error>(())
});
})
.await?;
}
Ok(())
}
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unstable_features = true
2 changes: 2 additions & 0 deletions src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ impl AsyncWrite for TcpStream {
///
/// [`TcpStream::connect`]: struct.TcpStream.html#method.connect
/// [`TcpStream`]: struct.TcpStream.html
#[must_use]
pub struct Connect {
addrs: Option<io::Result<VecDeque<SocketAddr>>>,
last_err: Option<io::Error>,
Expand Down Expand Up @@ -452,6 +453,7 @@ impl TcpListener {
///
/// [`TcpStream::accept`]: struct.TcpStream.html#method.accept
/// [`TcpStream`]: struct.TcpStream.html
#[must_use]
#[derive(Debug)]
pub struct Accept<'stream> {
inner: Incoming<'stream>,
Expand Down
2 changes: 2 additions & 0 deletions src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ impl UdpSocket {
/// On success, returns the number of bytes written.
///
/// [`UdpSocket::send_to`]: struct.UdpSocket.html#method.send_to
#[must_use]
#[derive(Debug)]
pub struct SendTo<'socket, 'buf> {
/// The open socket we use to send the message from.
Expand Down Expand Up @@ -392,6 +393,7 @@ impl<'socket, 'buf> Future for SendTo<'socket, 'buf> {
/// On success, returns the number of bytes read and the origin.
///
/// [`UdpSocket::recv_from`]: struct.UdpSocket.html#method.recv_from
#[must_use]
#[derive(Debug)]
pub struct RecvFrom<'socket, 'buf> {
socket: &'socket mut UdpSocket,
Expand Down
1 change: 1 addition & 0 deletions src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
/// A handle that awaits the result of a [`spawn`]ed future.
///
/// [`spawn`]: fn.spawn.html
#[must_use]
#[derive(Debug)]
pub struct JoinHandle<T> {
pub(crate) rx: futures::channel::oneshot::Receiver<T>,
Expand Down