]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/issue_2356.rs
Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors
[rust.git] / src / tools / clippy / tests / ui / issue_2356.rs
1 // run-rustfix
2 #![deny(clippy::while_let_on_iterator)]
3 #![allow(unused_mut)]
4
5 use std::iter::Iterator;
6
7 struct Foo;
8
9 impl Foo {
10     fn foo1<I: Iterator<Item = usize>>(mut it: I) {
11         while let Some(_) = it.next() {
12             println!("{:?}", it.size_hint());
13         }
14     }
15
16     fn foo2<I: Iterator<Item = usize>>(mut it: I) {
17         while let Some(e) = it.next() {
18             println!("{:?}", e);
19         }
20     }
21 }
22
23 fn main() {
24     Foo::foo1(vec![].into_iter());
25     Foo::foo2(vec![].into_iter());
26 }