|
1 |
| -error: called `cloned().last()` on an `Iterator`. It may be more efficient to call`.last().cloned()` instead |
| 1 | +error: called `cloned().last()` on an `Iterator`. It may be more efficient to call `last().cloned()` instead |
2 | 2 | --> $DIR/iter_overeager_cloned.rs:7:29
|
3 | 3 | |
|
4 | 4 | LL | let _: Option<String> = vec.iter().cloned().last();
|
5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().last().cloned()`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::iter-overeager-cloned` implied by `-D warnings`
|
8 | 8 |
|
9 |
| -error: called `cloned().next()` on an `Iterator`. It may be more efficient to call`.next().cloned()` instead |
| 9 | +error: called `cloned().next()` on an `Iterator`. It may be more efficient to call `next().cloned()` instead |
10 | 10 | --> $DIR/iter_overeager_cloned.rs:9:29
|
11 | 11 | |
|
12 | 12 | LL | let _: Option<String> = vec.iter().chain(vec.iter()).cloned().next();
|
13 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().chain(vec.iter()).next().cloned()`
|
14 | 14 |
|
15 |
| -error: called `cloned().count()` on an `Iterator`. It may be more efficient to call`.count()` instead |
| 15 | +error: called `cloned().count()` on an `Iterator`. It may be more efficient to call `count()` instead |
16 | 16 | --> $DIR/iter_overeager_cloned.rs:11:20
|
17 | 17 | |
|
18 | 18 | LL | let _: usize = vec.iter().filter(|x| x == &"2").cloned().count();
|
19 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().filter(|x| x == &"2").count()`
|
20 | 20 | |
|
21 | 21 | = note: `-D clippy::redundant-clone` implied by `-D warnings`
|
22 | 22 |
|
23 |
| -error: called `cloned().take(...)` on an `Iterator`. It may be more efficient to call`.take(...).cloned()` instead |
| 23 | +error: called `cloned().take(...)` on an `Iterator`. It may be more efficient to call `take(...).cloned()` instead |
24 | 24 | --> $DIR/iter_overeager_cloned.rs:13:21
|
25 | 25 | |
|
26 | 26 | LL | let _: Vec<_> = vec.iter().cloned().take(2).collect();
|
27 | 27 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().take(2).cloned()`
|
28 | 28 |
|
29 |
| -error: called `cloned().skip(...)` on an `Iterator`. It may be more efficient to call`.skip(...).cloned()` instead |
| 29 | +error: called `cloned().skip(...)` on an `Iterator`. It may be more efficient to call `skip(...).cloned()` instead |
30 | 30 | --> $DIR/iter_overeager_cloned.rs:15:21
|
31 | 31 | |
|
32 | 32 | LL | let _: Vec<_> = vec.iter().cloned().skip(2).collect();
|
33 | 33 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().skip(2).cloned()`
|
34 | 34 |
|
35 |
| -error: called `cloned().nth(...)` on an `Iterator`. It may be more efficient to call`.nth(...).cloned()` instead |
| 35 | +error: called `cloned().nth(...)` on an `Iterator`. It may be more efficient to call `nth(...).cloned()` instead |
36 | 36 | --> $DIR/iter_overeager_cloned.rs:17:13
|
37 | 37 | |
|
38 | 38 | LL | let _ = vec.iter().filter(|x| x == &"2").cloned().nth(2);
|
39 | 39 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec.iter().filter(|x| x == &"2").nth(2).cloned()`
|
40 | 40 |
|
41 |
| -error: called `cloned().flatten()` on an `Iterator`. It may be more efficient to call`.flatten().cloned()` instead |
| 41 | +error: called `cloned().flatten()` on an `Iterator`. It may be more efficient to call `flatten().cloned()` instead |
42 | 42 | --> $DIR/iter_overeager_cloned.rs:19:13
|
43 | 43 | |
|
44 | 44 | LL | let _ = [Some(Some("str".to_string())), Some(Some("str".to_string()))]
|
|
0 commit comments