1 error: avoid using `collect()` when not needed
2 --> $DIR/needless_collect.rs:11:29
4 LL | let len = sample.iter().collect::<Vec<_>>().len();
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
7 = note: `-D clippy::needless-collect` implied by `-D warnings`
9 error: avoid using `collect()` when not needed
10 --> $DIR/needless_collect.rs:12:22
12 LL | if sample.iter().collect::<Vec<_>>().is_empty() {
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
15 error: avoid using `collect()` when not needed
16 --> $DIR/needless_collect.rs:15:28
18 LL | sample.iter().cloned().collect::<Vec<_>>().contains(&1);
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
21 error: avoid using `collect()` when not needed
22 --> $DIR/needless_collect.rs:16:35
24 LL | sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().len();
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
27 error: aborting due to 4 previous errors