2020-08-11 08:43:21 -05:00
|
|
|
error: avoid using `collect()` when not needed
|
2023-06-10 06:54:00 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:9:39
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | let indirect_iter = sample.iter().collect::<Vec<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
...
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
|
|
|
| ------------------------- the iterator could be used here instead
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
|
|
|
= note: `-D clippy::needless-collect` implied by `-D warnings`
|
2021-03-12 08:30:50 -06:00
|
|
|
help: use the original Iterator instead of collecting it and then producing a new one
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:13:38
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | let indirect_len = sample.iter().collect::<VecDeque<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | indirect_len.len();
|
|
|
|
| ------------------ the iterator could be used here instead
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-03-12 08:30:50 -06:00
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().count();
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:16:40
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | let indirect_empty = sample.iter().collect::<VecDeque<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | indirect_empty.is_empty();
|
|
|
|
| ------------------------- the iterator could be used here instead
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-03-12 08:30:50 -06:00
|
|
|
help: check if the original Iterator has anything instead of collecting it and seeing if it's empty
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().next().is_none();
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:19:43
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | let indirect_contains = sample.iter().collect::<VecDeque<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | indirect_contains.contains(&&5);
|
|
|
|
| ------------------------------- the iterator could be used here instead
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-03-12 08:30:50 -06:00
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().any(|x| x == &5);
|
2020-08-11 08:43:21 -05:00
|
|
|
|
|
|
|
|
|
2020-10-28 17:36:07 -05:00
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:32:48
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-04-08 10:50:13 -05:00
|
|
|
LL | non_copy_contains.contains(&a);
|
|
|
|
| ------------------------------ the iterator could be used here instead
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
2021-03-12 08:30:50 -06:00
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.into_iter().any(|x| x == a);
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
|
2021-05-06 04:51:22 -05:00
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:62:51
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
LL | let buffer: Vec<&str> = string.split('/').collect();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-05-06 04:51:22 -05:00
|
|
|
LL | buffer.len()
|
|
|
|
| ------------ the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ string.split('/').count()
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:68:55
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
LL | let indirect_len: VecDeque<_> = sample.iter().collect();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-05-06 04:51:22 -05:00
|
|
|
LL | indirect_len.len()
|
|
|
|
| ------------------ the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().count()
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:74:57
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
LL | let indirect_len: LinkedList<_> = sample.iter().collect();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-05-06 04:51:22 -05:00
|
|
|
LL | indirect_len.len()
|
|
|
|
| ------------------ the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().count()
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:80:57
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
LL | let indirect_len: BinaryHeap<_> = sample.iter().collect();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-05-06 04:51:22 -05:00
|
|
|
LL | indirect_len.len()
|
|
|
|
| ------------------ the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ sample.iter().count()
|
2021-05-06 04:51:22 -05:00
|
|
|
|
|
|
|
|
|
2022-06-13 09:27:26 -05:00
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:141:59
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
| ^^^^^^^
|
|
|
|
...
|
|
|
|
LL | y.contains(&i);
|
|
|
|
| -------------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
LL | // Do lint
|
|
|
|
LL ~ vec.iter().map(|k| k * k).any(|x| x == i);
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:167:59
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
| ^^^^^^^
|
|
|
|
...
|
|
|
|
LL | y.contains(&n);
|
|
|
|
| -------------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
LL | // Do lint
|
|
|
|
LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:197:63
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
| ^^^^^^^
|
|
|
|
...
|
|
|
|
LL | y.contains(&n);
|
|
|
|
| -------------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | let z: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
LL | // Do lint
|
|
|
|
LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:234:59
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
|
|
|
| ^^^^^^^
|
|
|
|
...
|
|
|
|
LL | y.contains(&n);
|
|
|
|
| -------------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: check if the original Iterator contains an element instead of collecting then checking
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
|
|
|
...
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | // Do lint
|
|
|
|
LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-07-28 14:35:48 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:260:26
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let w = v.iter().collect::<Vec<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
...
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | for _ in 0..w.len() {
|
|
|
|
| ------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | // Do lint
|
2023-09-02 07:12:05 -05:00
|
|
|
LL | #[allow(clippy::never_loop)]
|
2022-06-13 09:27:26 -05:00
|
|
|
LL ~ for _ in 0..v.iter().count() {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-09-02 07:12:05 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:285:30
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let mut w = v.iter().collect::<Vec<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
...
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | while 1 == w.len() {
|
|
|
|
| ------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | // Do lint
|
2023-09-02 07:12:05 -05:00
|
|
|
LL | #[allow(clippy::never_loop)]
|
2022-06-13 09:27:26 -05:00
|
|
|
LL ~ while 1 == v.iter().count() {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: avoid using `collect()` when not needed
|
2023-09-02 07:12:05 -05:00
|
|
|
--> $DIR/needless_collect_indirect.rs:310:30
|
2022-06-13 09:27:26 -05:00
|
|
|
|
|
|
|
|
LL | let mut w = v.iter().collect::<Vec<_>>();
|
|
|
|
| ^^^^^^^
|
2023-07-28 14:35:48 -05:00
|
|
|
...
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | while let Some(i) = Some(w.len()) {
|
|
|
|
| ------- the iterator could be used here instead
|
|
|
|
|
|
|
|
|
help: take the original Iterator's count instead of collecting it and finding the length
|
|
|
|
|
|
|
|
|
LL ~
|
2023-07-28 14:35:48 -05:00
|
|
|
LL |
|
2022-06-13 09:27:26 -05:00
|
|
|
LL | // Do lint
|
2023-09-02 07:12:05 -05:00
|
|
|
LL | #[allow(clippy::never_loop)]
|
2022-06-13 09:27:26 -05:00
|
|
|
LL ~ while let Some(i) = Some(v.iter().count()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 16 previous errors
|
2020-08-11 08:43:21 -05:00
|
|
|
|