2022-01-17 06:29:07 -06:00
|
|
|
error: called `cloned().last()` on an `Iterator`. It may be more efficient to call `last().cloned()` instead
|
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();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().last().cloned()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::iter-overeager-cloned` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: called `cloned().next()` on an `Iterator`. It may be more efficient to call `next().cloned()` instead
|
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();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().chain(vec.iter()).next().cloned()`
|
|
|
|
|
|
|
|
error: called `cloned().count()` on an `Iterator`. It may be more efficient to call `count()` instead
|
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();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().filter(|x| x == &"2").count()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: called `cloned().take(...)` on an `Iterator`. It may be more efficient to call `take(...).cloned()` instead
|
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();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().take(2).cloned()`
|
|
|
|
|
|
|
|
error: called `cloned().skip(...)` on an `Iterator`. It may be more efficient to call `skip(...).cloned()` instead
|
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();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().skip(2).cloned()`
|
|
|
|
|
|
|
|
error: called `cloned().nth(...)` on an `Iterator`. It may be more efficient to call `nth(...).cloned()` instead
|
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);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().filter(|x| x == &"2").nth(2).cloned()`
|
|
|
|
|
|
|
|
error: called `cloned().flatten()` on an `Iterator`. It may be more efficient to call `flatten().cloned()` instead
|
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
|
|
|
|
|
|
|
|
|
LL ~ let _ = [Some(Some("str".to_string())), Some(Some("str".to_string()))]
|
|
|
|
LL ~ .iter().flatten().cloned();
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
|