// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::collections::{BTreeSet, HashMap, HashSet}; #[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(); }