Skip to content

Commit 1c8a1e5

Browse files
Philippe-Choletjswrenn
authored andcommitted
Add missing must_use attributes on adaptors
1 parent 04baddb commit 1c8a1e5

File tree

6 files changed

+6
-0
lines changed

6 files changed

+6
-0
lines changed

src/adaptors/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ where
185185
/// item to the front of the iterator.
186186
///
187187
/// Iterator element type is `I::Item`.
188+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
188189
pub struct PutBack<I>
189190
where
190191
I: Iterator,

src/combinations_with_replacement.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::adaptors::checked_binomial;
1010
/// See [`.combinations_with_replacement()`](crate::Itertools::combinations_with_replacement)
1111
/// for more information.
1212
#[derive(Clone)]
13+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
1314
pub struct CombinationsWithReplacement<I>
1415
where
1516
I: Iterator,

src/multipeek_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::iter::Fuse;
77

88
/// See [`multipeek()`] for more information.
99
#[derive(Clone, Debug)]
10+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
1011
pub struct MultiPeek<I>
1112
where
1213
I: Iterator,

src/peek_nth.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::iter::Fuse;
55

66
/// See [`peek_nth()`] for more information.
77
#[derive(Clone, Debug)]
8+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
89
pub struct PeekNth<I>
910
where
1011
I: Iterator,

src/put_back_n_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::size_hint;
77
///
88
/// Iterator element type is `I::Item`.
99
#[derive(Debug, Clone)]
10+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
1011
pub struct PutBackN<I: Iterator> {
1112
top: Vec<I::Item>,
1213
iter: I,

src/rciter_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::iter::{FusedIterator, IntoIterator};
44

55
/// A wrapper for `Rc<RefCell<I>>`, that implements the `Iterator` trait.
66
#[derive(Debug)]
7+
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
78
pub struct RcIter<I> {
89
/// The boxed iterator.
910
pub rciter: Rc<RefCell<I>>,

0 commit comments

Comments
 (0)