fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1#![deny(clippy::while_let_on_iterator)] 2#![allow(unused_mut)] 3#![allow(clippy::uninlined_format_args)] 4 5use std::iter::Iterator; 6 7struct Foo; 8 9impl 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 for e in it { 18 println!("{:?}", e); 19 } 20 } 21} 22 23fn main() { 24 Foo::foo1(vec![].into_iter()); 25 Foo::foo2(vec![].into_iter()); 26}