]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_collect.stderr
Auto merge of #5597 - esamudera:slice_iter_next, r=flip1995
[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:15
11    |
12 LL |     if sample.iter().collect::<Vec<_>>().is_empty() {
13    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `get(0).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:16:35
23    |
24 LL |     sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().len();
25    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
26
27 error: aborting due to 4 previous errors
28