1 error: avoid using `collect()` when not needed
2 --> $DIR/needless_collect_indirect.rs:5:5
4 LL | / let indirect_iter = sample.iter().collect::<Vec<_>>();
5 LL | | indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
8 = note: `-D clippy::needless-collect` implied by `-D warnings`
9 help: Use the original Iterator instead of collecting it and then producing a new one
12 LL | sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
15 error: avoid using `collect()` when not needed
16 --> $DIR/needless_collect_indirect.rs:7:5
18 LL | / let indirect_len = sample.iter().collect::<VecDeque<_>>();
19 LL | | indirect_len.len();
22 help: Take the original Iterator's count instead of collecting it and finding the length
25 LL | sample.iter().count();
28 error: avoid using `collect()` when not needed
29 --> $DIR/needless_collect_indirect.rs:9:5
31 LL | / let indirect_empty = sample.iter().collect::<VecDeque<_>>();
32 LL | | indirect_empty.is_empty();
35 help: Check if the original Iterator has anything instead of collecting it and seeing if it's empty
38 LL | sample.iter().next().is_none();
41 error: avoid using `collect()` when not needed
42 --> $DIR/needless_collect_indirect.rs:11:5
44 LL | / let indirect_contains = sample.iter().collect::<VecDeque<_>>();
45 LL | | indirect_contains.contains(&&5);
48 help: Check if the original Iterator contains an element instead of collecting then checking
51 LL | sample.iter().any(|x| x == &5);
54 error: avoid using `collect()` when not needed
55 --> $DIR/needless_collect_indirect.rs:23:5
57 LL | / let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
58 LL | | non_copy_contains.contains(&a);
61 help: Check if the original Iterator contains an element instead of collecting then checking
64 LL | sample.into_iter().any(|x| x == a);
67 error: aborting due to 5 previous errors