| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:15:29 |
| | |
| LL | let len = sample.iter().collect::<Vec<_>>().len(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` |
| | |
| = note: `-D clippy::needless-collect` implied by `-D warnings` |
| = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:17:22 |
| | |
| LL | if sample.iter().collect::<Vec<_>>().is_empty() { |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:21:28 |
| | |
| LL | sample.iter().cloned().collect::<Vec<_>>().contains(&1); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:24:36 |
| | |
| LL | let _ = sample.iter().cloned().collect::<Vec<_>>()[1]; |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `nth(1).unwrap()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:31:35 |
| | |
| LL | sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:33:35 |
| | |
| LL | sample.iter().map(|x| (x, x)).collect::<BTreeMap<_, _>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:41:19 |
| | |
| LL | sample.iter().collect::<LinkedList<_>>().len(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:43:19 |
| | |
| LL | sample.iter().collect::<LinkedList<_>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:45:28 |
| | |
| LL | sample.iter().cloned().collect::<LinkedList<_>>().contains(&1); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:47:19 |
| | |
| LL | sample.iter().collect::<LinkedList<_>>().contains(&&1); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:51:19 |
| | |
| LL | sample.iter().collect::<BinaryHeap<_>>().len(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:53:19 |
| | |
| LL | sample.iter().collect::<BinaryHeap<_>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:59:27 |
| | |
| LL | let _ = sample.iter().collect::<HashSet<_>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:61:27 |
| | |
| LL | let _ = sample.iter().collect::<HashSet<_>>().contains(&&0); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:84:27 |
| | |
| LL | let _ = sample.iter().collect::<VecWrapper<_>>().is_empty(); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:86:27 |
| | |
| LL | let _ = sample.iter().collect::<VecWrapper<_>>().contains(&&0); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:91:40 |
| | |
| LL | Vec::<u8>::new().extend((0..10).collect::<Vec<_>>()); |
| | ^^^^^^^^^^^^^^^^^^^^ help: remove this call |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:93:20 |
| | |
| LL | foo((0..10).collect::<Vec<_>>()); |
| | ^^^^^^^^^^^^^^^^^^^^ help: remove this call |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:95:49 |
| | |
| LL | bar((0..10).collect::<Vec<_>>(), (0..10).collect::<Vec<_>>()); |
| | ^^^^^^^^^^^^^^^^^^^^ help: remove this call |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:97:37 |
| | |
| LL | baz((0..10), (), ('a'..='z').collect::<Vec<_>>()) |
| | ^^^^^^^^^^^^^^^^^^^^ help: remove this call |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:228:26 |
| | |
| LL | let mut v = iter.collect::<Vec<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | v.into_iter().map(|x| x + 1).collect() |
| | ------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ iter.chain([1]).map(|x| x + 1).collect() |
| | |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:240:26 |
| | |
| LL | let mut v = iter.collect::<Vec<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | v.into_iter().map(|x| x + 1).collect() |
| | ------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ |
| LL ~ iter.chain([1, 2]).map(|x| x + 1).collect() |
| | |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:248:26 |
| | |
| LL | let mut v = iter.collect::<LinkedList<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | v.into_iter().map(|x| x + 1).collect() |
| | ------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ iter.chain([1]).map(|x| x + 1).collect() |
| | |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:268:27 |
| | |
| LL | let mut ll = iter.collect::<LinkedList<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | ll.into_iter().map(|x| x + 1).collect() |
| | -------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ iter.chain(s).map(|x| x + 1).collect() |
| | |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:275:26 |
| | |
| LL | let mut v = iter.collect::<VecDeque<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | v.into_iter().map(|x| x + 1).collect() |
| | ------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ |
| LL ~ [1, 2].into_iter().chain(iter).map(|x| x + 1).collect() |
| | |
| |
| error: avoid using `collect()` when not needed |
| --> tests/ui/needless_collect.rs:286:26 |
| | |
| LL | let mut v = iter.collect::<LinkedList<_>>(); |
| | ^^^^^^^ |
| ... |
| LL | v.into_iter().map(|x| x + 1).collect() |
| | ------------- the iterator could be used here instead |
| | |
| help: use the original Iterator instead of collecting it and then producing a new one |
| | |
| LL ~ |
| LL | |
| LL ~ |
| LL ~ |
| LL ~ |
| LL ~ |
| LL ~ |
| LL ~ |
| LL ~ |
| LL ~ [5].into_iter().chain([1, 3].into_iter().chain(iter).chain([2]).chain(iter2)).chain([4, 6]).map(|x| x + 1).collect() |
| | |
| |
| error: aborting due to 26 previous errors |
| |