]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #![deny(clippy::while_let_on_iterator)] |
2 | ||
3 | use std::iter::Iterator; | |
4 | ||
5 | struct Foo; | |
6 | ||
7 | impl Foo { | |
8 | fn foo1<I: Iterator<Item = usize>>(mut it: I) { | |
9 | while let Some(_) = it.next() { | |
10 | println!("{:?}", it.size_hint()); | |
11 | } | |
12 | } | |
13 | ||
14 | fn foo2<I: Iterator<Item = usize>>(mut it: I) { | |
15 | while let Some(e) = it.next() { | |
16 | println!("{:?}", e); | |
17 | } | |
18 | } | |
19 | } | |
20 | ||
21 | fn main() { | |
22 | Foo::foo1(vec![].into_iter()); | |
23 | Foo::foo2(vec![].into_iter()); | |
24 | } |