Closed ibaryshnikov closed 5 years ago
@ibaryshnikov the same message can be used for streams
#[must_use = "streams do nothing unless you `.await` or poll them"]
@yoshuawuyts
#[must_use = "streams do nothing unless you `.await` or poll them"]
I think the message may be misleading, as streams cannot use .await
directly.
Related: https://github.com/rust-lang-nursery/futures-rs/pull/1600
@taiki-e ah yeah, fair -- I guess the way we want to go is for x.await in y {}
loops, but not sure how to mention that. "polled" is probably accurate (poll_next
), but await... is currently only sort of accurate? Do you have a suggestion for something better?
@yoshuawuyts
I don't know what the more desirable error message is.
For example, .next().await
may be more convenient, but this may not be appropriate because next
is not a method of Stream
trait. Also, we use must_use for impl Sink
types, so I don't know if the message related to a specific method name is really good.
This also depends on how Stream
trait is added in the language, so, for now, I think it is better to postpone the stream must_use message problem.
By the way, "improwed" in the commit message and the title looks like a typo.
for now, I think it is better to postpone the stream must_use message problem.
@taiki-e that sounds reasonable (:
Follows https://github.com/rustasync/runtime/pull/31#issuecomment-492593832 I guess this variant was merged in
rust-lang/rust
. What about message for streams?