@@ -30,5 +30,41 @@ error: avoid using `collect()` when not needed
3030LL | sample.iter().map(|x| (x, x)).collect::<BTreeMap<_, _>>().is_empty();
3131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
3232
33- error: aborting due to 5 previous errors
33+ error: avoid using `collect()` when not needed
34+ --> $DIR/needless_collect.rs:28:19
35+ |
36+ LL | sample.iter().collect::<LinkedList<_>>().len();
37+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
38+
39+ error: avoid using `collect()` when not needed
40+ --> $DIR/needless_collect.rs:29:19
41+ |
42+ LL | sample.iter().collect::<LinkedList<_>>().is_empty();
43+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
44+
45+ error: avoid using `collect()` when not needed
46+ --> $DIR/needless_collect.rs:30:28
47+ |
48+ LL | sample.iter().cloned().collect::<LinkedList<_>>().contains(&1);
49+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
50+
51+ error: avoid using `collect()` when not needed
52+ --> $DIR/needless_collect.rs:31:19
53+ |
54+ LL | sample.iter().collect::<LinkedList<_>>().contains(&&1);
55+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)`
56+
57+ error: avoid using `collect()` when not needed
58+ --> $DIR/needless_collect.rs:34:19
59+ |
60+ LL | sample.iter().collect::<BinaryHeap<_>>().len();
61+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
62+
63+ error: avoid using `collect()` when not needed
64+ --> $DIR/needless_collect.rs:35:19
65+ |
66+ LL | sample.iter().collect::<BinaryHeap<_>>().is_empty();
67+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
68+
69+ error: aborting due to 11 previous errors
3470
0 commit comments