diff --git a/src/lib.rs b/src/lib.rs index 37c3b1f41..4acbbe112 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2299,6 +2299,7 @@ pub trait Itertools: Iterator { /// `.collect_vec()` is simply a type specialization of [`Iterator::collect`], /// for convenience. + #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"] #[cfg(feature = "use_alloc")] fn collect_vec(self) -> Vec where @@ -2330,6 +2331,7 @@ pub trait Itertools: Iterator { /// /// # let _ = do_stuff; /// ``` + #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"] fn try_collect(self) -> Result where Self: Sized + Iterator>,