1 error: avoid using `collect()` when not needed
2 --> $DIR/needless_collect_indirect.rs:5:39
4 LL | let indirect_iter = sample.iter().collect::<Vec<_>>();
6 LL | indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
7 | ------------------------- the iterator could be used here instead
9 = note: `-D clippy::needless-collect` implied by `-D warnings`
10 help: use the original Iterator instead of collecting it and then producing a new one
13 LL ~ sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
16 error: avoid using `collect()` when not needed
17 --> $DIR/needless_collect_indirect.rs:7:38
19 LL | let indirect_len = sample.iter().collect::<VecDeque<_>>();
21 LL | indirect_len.len();
22 | ------------------ the iterator could be used here instead
24 help: take the original Iterator's count instead of collecting it and finding the length
27 LL ~ sample.iter().count();
30 error: avoid using `collect()` when not needed
31 --> $DIR/needless_collect_indirect.rs:9:40
33 LL | let indirect_empty = sample.iter().collect::<VecDeque<_>>();
35 LL | indirect_empty.is_empty();
36 | ------------------------- the iterator could be used here instead
38 help: check if the original Iterator has anything instead of collecting it and seeing if it's empty
41 LL ~ sample.iter().next().is_none();
44 error: avoid using `collect()` when not needed
45 --> $DIR/needless_collect_indirect.rs:11:43
47 LL | let indirect_contains = sample.iter().collect::<VecDeque<_>>();
49 LL | indirect_contains.contains(&&5);
50 | ------------------------------- the iterator could be used here instead
52 help: check if the original Iterator contains an element instead of collecting then checking
55 LL ~ sample.iter().any(|x| x == &5);
58 error: avoid using `collect()` when not needed
59 --> $DIR/needless_collect_indirect.rs:23:48
61 LL | let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
63 LL | non_copy_contains.contains(&a);
64 | ------------------------------ the iterator could be used here instead
66 help: check if the original Iterator contains an element instead of collecting then checking
69 LL ~ sample.into_iter().any(|x| x == a);
72 error: avoid using `collect()` when not needed
73 --> $DIR/needless_collect_indirect.rs:52:51
75 LL | let buffer: Vec<&str> = string.split('/').collect();
78 | ------------ the iterator could be used here instead
80 help: take the original Iterator's count instead of collecting it and finding the length
83 LL ~ string.split('/').count()
86 error: avoid using `collect()` when not needed
87 --> $DIR/needless_collect_indirect.rs:57:55
89 LL | let indirect_len: VecDeque<_> = sample.iter().collect();
91 LL | indirect_len.len()
92 | ------------------ the iterator could be used here instead
94 help: take the original Iterator's count instead of collecting it and finding the length
97 LL ~ sample.iter().count()
100 error: avoid using `collect()` when not needed
101 --> $DIR/needless_collect_indirect.rs:62:57
103 LL | let indirect_len: LinkedList<_> = sample.iter().collect();
105 LL | indirect_len.len()
106 | ------------------ the iterator could be used here instead
108 help: take the original Iterator's count instead of collecting it and finding the length
111 LL ~ sample.iter().count()
114 error: avoid using `collect()` when not needed
115 --> $DIR/needless_collect_indirect.rs:67:57
117 LL | let indirect_len: BinaryHeap<_> = sample.iter().collect();
119 LL | indirect_len.len()
120 | ------------------ the iterator could be used here instead
122 help: take the original Iterator's count instead of collecting it and finding the length
125 LL ~ sample.iter().count()
128 error: aborting due to 9 previous errors