Skip to content

Add #[must_use] to Stream and Sink #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions futures-core/src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub use self::stream_obj::{StreamObj,LocalStreamObj,UnsafeStreamObj};
/// The trait is modeled after `Future`, but allows `poll_next` to be called
/// even after a value has been produced, yielding `None` once the stream has
/// been fully exhausted.
#[must_use = "streams do nothing unless polled"]
pub trait Stream {
/// Values yielded by the stream.
type Item;
Expand Down
1 change: 1 addition & 0 deletions futures-sink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use core::pin::Pin;
/// higher-level way. The `Sink::send_all` combinator is of particular
/// importance: you can use it to send an entire stream to a sink, which is
/// the simplest way to ultimately consume a stream.
#[must_use = "sinks do nothing unless polled"]
pub trait Sink {
/// The type of value that the sink accepts.
type SinkItem;
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/sink/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use executor;
/// Created by the `Sink::wait` method, this function transforms any sink into a
/// blocking version. This is implemented by blocking the current thread when a
/// sink is otherwise unable to make progress.
#[must_use = "sinks do nothing unless used"]
#[must_use = "sinks do nothing unless polled"]
#[derive(Debug)]
pub struct Wait<Si> {
sink: executor::Spawn<Si>,
Expand Down