Skip to content

Commit 5884327

Browse files
taiki-ecramertj
authored andcommitted
Add #[must_use] to more types
1 parent 64b68ea commit 5884327

29 files changed

+31
-17
lines changed

futures-util/src/future/into_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use futures_core::task::{Context, Poll};
55
use pin_utils::unsafe_pinned;
66

77
/// Stream for the [`into_stream`](super::FutureExt::into_stream) method.
8-
#[must_use = "futures do nothing unless polled"]
8+
#[must_use = "streams do nothing unless polled"]
99
#[derive(Debug)]
1010
pub struct IntoStream<Fut: Future> {
1111
future: Option<Fut>

futures-util/src/io/close.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +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"]
910
pub struct Close<'a, W: ?Sized + Unpin> {
1011
writer: &'a mut W,
1112
}

futures-util/src/io/copy_into.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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"]
1011
pub struct CopyInto<'a, R: ?Sized + Unpin, W: ?Sized + Unpin> {
1112
reader: &'a mut R,
1213
read_done: bool,

futures-util/src/io/flush.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +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"]
910
pub struct Flush<'a, W: ?Sized + Unpin> {
1011
writer: &'a mut W,
1112
}

futures-util/src/io/lines.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use super::read_line::read_line_internal;
88

99
/// Stream for the [`lines`](super::AsyncBufReadExt::lines) method.
1010
#[derive(Debug)]
11+
#[must_use = "streams do nothing unless polled"]
1112
pub struct Lines<R> {
1213
reader: R,
1314
buf: String,

futures-util/src/io/read.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +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"]
910
pub struct Read<'a, R: ?Sized + Unpin> {
1011
reader: &'a mut R,
1112
buf: &'a mut [u8],

futures-util/src/io/read_exact.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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"]
1011
pub struct ReadExact<'a, R: ?Sized + Unpin> {
1112
reader: &'a mut R,
1213
buf: &'a mut [u8],

futures-util/src/io/read_line.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +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"]
1213
pub struct ReadLine<'a, R: ?Sized + Unpin> {
1314
reader: &'a mut R,
1415
buf: &'a mut String,

futures-util/src/io/read_to_end.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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"]
1011
pub struct ReadToEnd<'a, R: ?Sized + Unpin> {
1112
reader: &'a mut R,
1213
buf: &'a mut Vec<u8>,

futures-util/src/io/read_until.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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"]
1011
pub struct ReadUntil<'a, R: ?Sized + Unpin> {
1112
reader: &'a mut R,
1213
byte: u8,

0 commit comments

Comments
 (0)