2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:8:29
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<String> = vec.iter().cloned().last();
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.last().cloned()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::iter-overeager-cloned` implied by `-D warnings`
|
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:10:29
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<String> = vec.iter().chain(vec.iter()).cloned().next();
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.next().cloned()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unneeded cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:12:20
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: usize = vec.iter().filter(|x| x == &"2").cloned().count();
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.count()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
|
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:14:21
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Vec<_> = vec.iter().cloned().take(2).collect();
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^-----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.take(2).cloned()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:16:21
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Vec<_> = vec.iter().cloned().skip(2).collect();
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^-----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.skip(2).cloned()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:18:13
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _ = vec.iter().filter(|x| x == &"2").cloned().nth(2);
|
2022-06-16 10:39:06 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------
|
|
|
|
| |
|
|
|
|
| help: try this: `.nth(2).cloned()`
|
2022-01-17 06:29:07 -06:00
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
error: unnecessarily eager cloning of iterator items
|
2022-04-07 12:39:59 -05:00
|
|
|
--> $DIR/iter_overeager_cloned.rs:20:13
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
LL | let _ = [Some(Some("str".to_string())), Some(Some("str".to_string()))]
|
|
|
|
| _____________^
|
|
|
|
LL | | .iter()
|
|
|
|
LL | | .cloned()
|
|
|
|
LL | | .flatten();
|
|
|
|
| |__________________^
|
|
|
|
|
|
|
|
|
help: try this
|
|
|
|
|
|
2022-06-16 10:39:06 -05:00
|
|
|
LL ~ .iter()
|
|
|
|
LL ~ .flatten().cloned();
|
2022-01-17 06:29:07 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
|