]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_collect.stderr
3acdf66a42e1d37123693dd658a4a999b81e28d4
[rust.git] / tests / ui / needless_collect.stderr
1 error: avoid using `collect()` when not needed
2   --> $DIR/needless_collect.rs:11:29
3    |
4 LL |     let len = sample.iter().collect::<Vec<_>>().len();
5    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
6    |
7    = note: `-D clippy::needless-collect` implied by `-D warnings`
8
9 error: avoid using `collect()` when not needed
10   --> $DIR/needless_collect.rs:12:22
11    |
12 LL |     if sample.iter().collect::<Vec<_>>().is_empty() {
13    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
14
15 error: avoid using `collect()` when not needed
16   --> $DIR/needless_collect.rs:15:28
17    |
18 LL |     sample.iter().cloned().collect::<Vec<_>>().contains(&1);
19    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
20
21 error: avoid using `collect()` when not needed
22   --> $DIR/needless_collect.rs:20:35
23    |
24 LL |     sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().is_empty();
25    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
26
27 error: avoid using `collect()` when not needed
28   --> $DIR/needless_collect.rs:21:35
29    |
30 LL |     sample.iter().map(|x| (x, x)).collect::<BTreeMap<_, _>>().is_empty();
31    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
32
33 error: aborting due to 5 previous errors
34