Skip to content

Commit 6d44293

Browse files
committed
Add #[must_use] message to Iterator and Future
1 parent d6525ef commit 6d44293

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libcore/future/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use task::{Poll, LocalWaker};
2323
///
2424
/// When using a future, you generally won't call `poll` directly, but instead
2525
/// `await!` the value.
26-
#[must_use]
26+
#[must_use = "futures do nothing unless polled"]
2727
pub trait Future {
2828
/// The result of the `Future`.
2929
type Output;

src/libcore/iter/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
8888
message="`{Self}` is not an iterator"
8989
)]
9090
#[doc(spotlight)]
91-
#[must_use]
91+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
9292
pub trait Iterator {
9393
/// The type of the elements being iterated over.
9494
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)