1 error: avoid using `collect()` when not needed
2 --> $DIR/needless_collect_indirect.rs:7: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:9: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:11: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:13: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:25: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:54: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:59: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:64: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:69: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: avoid using `collect()` when not needed
129 --> $DIR/needless_collect_indirect.rs:129:59
131 LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
135 | -------------- the iterator could be used here instead
137 help: check if the original Iterator contains an element instead of collecting then checking
140 LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
142 LL ~ vec.iter().map(|k| k * k).any(|x| x == i);
145 error: avoid using `collect()` when not needed
146 --> $DIR/needless_collect_indirect.rs:154:59
148 LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
152 | -------------- the iterator could be used here instead
154 help: check if the original Iterator contains an element instead of collecting then checking
157 LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
159 LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
162 error: avoid using `collect()` when not needed
163 --> $DIR/needless_collect_indirect.rs:183:63
165 LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
169 | -------------- the iterator could be used here instead
171 help: check if the original Iterator contains an element instead of collecting then checking
174 LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
176 LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
179 error: avoid using `collect()` when not needed
180 --> $DIR/needless_collect_indirect.rs:219:59
182 LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
186 | -------------- the iterator could be used here instead
188 help: check if the original Iterator contains an element instead of collecting then checking
191 LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
194 LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
197 error: avoid using `collect()` when not needed
198 --> $DIR/needless_collect_indirect.rs:244:26
200 LL | let w = v.iter().collect::<Vec<_>>();
203 LL | for _ in 0..w.len() {
204 | ------- the iterator could be used here instead
206 help: take the original Iterator's count instead of collecting it and finding the length
210 LL ~ for _ in 0..v.iter().count() {
213 error: avoid using `collect()` when not needed
214 --> $DIR/needless_collect_indirect.rs:266:30
216 LL | let mut w = v.iter().collect::<Vec<_>>();
219 LL | while 1 == w.len() {
220 | ------- the iterator could be used here instead
222 help: take the original Iterator's count instead of collecting it and finding the length
226 LL ~ while 1 == v.iter().count() {
229 error: avoid using `collect()` when not needed
230 --> $DIR/needless_collect_indirect.rs:288:30
232 LL | let mut w = v.iter().collect::<Vec<_>>();
235 LL | while let Some(i) = Some(w.len()) {
236 | ------- the iterator could be used here instead
238 help: take the original Iterator's count instead of collecting it and finding the length
242 LL ~ while let Some(i) = Some(v.iter().count()) {
245 error: aborting due to 16 previous errors