diff options
| author | Taiki Endo <te316e89@gmail.com> | 2019-01-13 02:57:27 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2019-01-13 02:57:27 +0900 |
| commit | 6d442938e04a851dc8b01ad810e150fb04129986 (patch) | |
| tree | 039151ef97a03a021165aca0909e1274c7c17e0f | |
| parent | d6525ef539a04cb43de40080bdabc5f2f5a4a197 (diff) | |
| download | rust-6d442938e04a851dc8b01ad810e150fb04129986.tar.gz rust-6d442938e04a851dc8b01ad810e150fb04129986.zip | |
Add #[must_use] message to Iterator and Future
| -rw-r--r-- | src/libcore/future/future.rs | 2 | ||||
| -rw-r--r-- | src/libcore/iter/iterator.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 0bc8a0fd26a..539b07fc21e 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -23,7 +23,7 @@ use task::{Poll, LocalWaker}; /// /// When using a future, you generally won't call `poll` directly, but instead /// `await!` the value. -#[must_use] +#[must_use = "futures do nothing unless polled"] pub trait Future { /// The result of the `Future`. type Output; diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 1ea500858ed..6cac152aab5 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -88,7 +88,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {} message="`{Self}` is not an iterator" )] #[doc(spotlight)] -#[must_use] +#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub trait Iterator { /// The type of the elements being iterated over. #[stable(feature = "rust1", since = "1.0.0")] |
