@@ -20,100 +20,106 @@ LL | sample.iter().cloned().collect::<Vec<_>>().contains(&1);
2020 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
2121
2222error: avoid using `collect()` when not needed
23- --> tests/ui/needless_collect.rs:27:35
23+ --> tests/ui/needless_collect.rs:24:36
24+ |
25+ LL | let _ = sample.iter().cloned().collect::<Vec<_>>()[1];
26+ | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `nth(1).unwrap()`
27+
28+ error: avoid using `collect()` when not needed
29+ --> tests/ui/needless_collect.rs:31:35
2430 |
2531LL | sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().is_empty();
2632 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
2733
2834error: avoid using `collect()` when not needed
29- --> tests/ui/needless_collect.rs:29 :35
35+ --> tests/ui/needless_collect.rs:33 :35
3036 |
3137LL | sample.iter().map(|x| (x, x)).collect::<BTreeMap<_, _>>().is_empty();
3238 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
3339
3440error: avoid using `collect()` when not needed
35- --> tests/ui/needless_collect.rs:37 :19
41+ --> tests/ui/needless_collect.rs:41 :19
3642 |
3743LL | sample.iter().collect::<LinkedList<_>>().len();
3844 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
3945
4046error: avoid using `collect()` when not needed
41- --> tests/ui/needless_collect.rs:39 :19
47+ --> tests/ui/needless_collect.rs:43 :19
4248 |
4349LL | sample.iter().collect::<LinkedList<_>>().is_empty();
4450 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
4551
4652error: avoid using `collect()` when not needed
47- --> tests/ui/needless_collect.rs:41 :28
53+ --> tests/ui/needless_collect.rs:45 :28
4854 |
4955LL | sample.iter().cloned().collect::<LinkedList<_>>().contains(&1);
5056 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
5157
5258error: avoid using `collect()` when not needed
53- --> tests/ui/needless_collect.rs:43 :19
59+ --> tests/ui/needless_collect.rs:47 :19
5460 |
5561LL | sample.iter().collect::<LinkedList<_>>().contains(&&1);
5662 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)`
5763
5864error: avoid using `collect()` when not needed
59- --> tests/ui/needless_collect.rs:47 :19
65+ --> tests/ui/needless_collect.rs:51 :19
6066 |
6167LL | sample.iter().collect::<BinaryHeap<_>>().len();
6268 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
6369
6470error: avoid using `collect()` when not needed
65- --> tests/ui/needless_collect.rs:49 :19
71+ --> tests/ui/needless_collect.rs:53 :19
6672 |
6773LL | sample.iter().collect::<BinaryHeap<_>>().is_empty();
6874 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
6975
7076error: avoid using `collect()` when not needed
71- --> tests/ui/needless_collect.rs:55 :27
77+ --> tests/ui/needless_collect.rs:59 :27
7278 |
7379LL | let _ = sample.iter().collect::<HashSet<_>>().is_empty();
7480 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
7581
7682error: avoid using `collect()` when not needed
77- --> tests/ui/needless_collect.rs:57 :27
83+ --> tests/ui/needless_collect.rs:61 :27
7884 |
7985LL | let _ = sample.iter().collect::<HashSet<_>>().contains(&&0);
8086 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)`
8187
8288error: avoid using `collect()` when not needed
83- --> tests/ui/needless_collect.rs:80 :27
89+ --> tests/ui/needless_collect.rs:84 :27
8490 |
8591LL | let _ = sample.iter().collect::<VecWrapper<_>>().is_empty();
8692 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
8793
8894error: avoid using `collect()` when not needed
89- --> tests/ui/needless_collect.rs:82 :27
95+ --> tests/ui/needless_collect.rs:86 :27
9096 |
9197LL | let _ = sample.iter().collect::<VecWrapper<_>>().contains(&&0);
9298 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)`
9399
94100error: avoid using `collect()` when not needed
95- --> tests/ui/needless_collect.rs:87 :40
101+ --> tests/ui/needless_collect.rs:91 :40
96102 |
97103LL | Vec::<u8>::new().extend((0..10).collect::<Vec<_>>());
98104 | ^^^^^^^^^^^^^^^^^^^^ help: remove this call
99105
100106error: avoid using `collect()` when not needed
101- --> tests/ui/needless_collect.rs:89 :20
107+ --> tests/ui/needless_collect.rs:93 :20
102108 |
103109LL | foo((0..10).collect::<Vec<_>>());
104110 | ^^^^^^^^^^^^^^^^^^^^ help: remove this call
105111
106112error: avoid using `collect()` when not needed
107- --> tests/ui/needless_collect.rs:91 :49
113+ --> tests/ui/needless_collect.rs:95 :49
108114 |
109115LL | bar((0..10).collect::<Vec<_>>(), (0..10).collect::<Vec<_>>());
110116 | ^^^^^^^^^^^^^^^^^^^^ help: remove this call
111117
112118error: avoid using `collect()` when not needed
113- --> tests/ui/needless_collect.rs:93 :37
119+ --> tests/ui/needless_collect.rs:97 :37
114120 |
115121LL | baz((0..10), (), ('a'..='z').collect::<Vec<_>>())
116122 | ^^^^^^^^^^^^^^^^^^^^ help: remove this call
117123
118- error: aborting due to 19 previous errors
124+ error: aborting due to 20 previous errors
119125
0 commit comments