#![feature(tool_lints)] use std::collections::{HashMap, HashSet, BTreeSet}; #[warn(clippy::needless_collect)] #[allow(unused_variables, clippy::iter_cloned_collect)] fn main() { let sample = [1; 5]; let len = sample.iter().collect::>().len(); if sample.iter().collect::>().is_empty() { // Empty } sample.iter().cloned().collect::>().contains(&1); sample.iter().map(|x| (x, x)).collect::>().len(); // Notice the `HashSet`--this should not be linted sample.iter().collect::>().len(); // Neither should this sample.iter().collect::>().len(); }