mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-28 05:53:35 +00:00
27 lines
1.1 KiB
Text
27 lines
1.1 KiB
Text
|
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||
|
--> $DIR/iter_cloned_collect.rs:10:27
|
||
|
|
|
||
|
LL | let v2: Vec<isize> = v.iter().cloned().collect();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||
|
|
|
||
|
= note: `-D clippy::iter-cloned-collect` implied by `-D warnings`
|
||
|
|
||
|
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||
|
--> $DIR/iter_cloned_collect.rs:15:38
|
||
|
|
|
||
|
LL | let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||
|
|
||
|
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||
|
--> $DIR/iter_cloned_collect.rs:20:24
|
||
|
|
|
||
|
LL | .to_bytes()
|
||
|
| ________________________^
|
||
|
LL | | .iter()
|
||
|
LL | | .cloned()
|
||
|
LL | | .collect();
|
||
|
| |______________________^ help: try: `.to_vec()`
|
||
|
|
||
|
error: aborting due to 3 previous errors
|
||
|
|