Closed
Description
pub fn main() {
// we start with an iterator
let iter = vec![1, 2, 3].into_iter();
// we do something with the items and collect into a vec
let v: Vec<i32> = iter.map(|x| x + 2).collect();
// but the first and only use of the vec uses .iter() or .into_iter(), which means we could skip collecting entirely.
v.into_iter().for_each(|x| println!("{}", x));
}
Would be awesome if clippy could catch such patterns :)