1
1
error: you are using an explicit closure for copying elements
2
- --> tests/ui/map_clone.rs:13 :22
2
+ --> tests/ui/map_clone.rs:14 :22
3
3
|
4
4
LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()`
@@ -8,85 +8,85 @@ LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
8
8
= help: to override `-D warnings` add `#[allow(clippy::map_clone)]`
9
9
10
10
error: you are using an explicit closure for cloning elements
11
- --> tests/ui/map_clone.rs:14 :26
11
+ --> tests/ui/map_clone.rs:15 :26
12
12
|
13
13
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
15
15
16
16
error: you are using an explicit closure for copying elements
17
- --> tests/ui/map_clone.rs:15 :23
17
+ --> tests/ui/map_clone.rs:16 :23
18
18
|
19
19
LL | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
20
20
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()`
21
21
22
22
error: you are using an explicit closure for copying elements
23
- --> tests/ui/map_clone.rs:17 :26
23
+ --> tests/ui/map_clone.rs:18 :26
24
24
|
25
25
LL | let _: Option<u64> = Some(&16).map(|b| *b);
26
26
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&16).copied()`
27
27
28
28
error: you are using an explicit closure for copying elements
29
- --> tests/ui/map_clone.rs:18 :25
29
+ --> tests/ui/map_clone.rs:19 :25
30
30
|
31
31
LL | let _: Option<u8> = Some(&1).map(|x| x.clone());
32
32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&1).copied()`
33
33
34
34
error: you are needlessly cloning iterator elements
35
- --> tests/ui/map_clone.rs:29 :29
35
+ --> tests/ui/map_clone.rs:30 :29
36
36
|
37
37
LL | let _ = std::env::args().map(|v| v.clone());
38
38
| ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call
39
39
40
40
error: you are explicitly cloning with `.map()`
41
- --> tests/ui/map_clone.rs:68 :13
41
+ --> tests/ui/map_clone.rs:69 :13
42
42
|
43
43
LL | let y = x.map(|x| String::clone(x));
44
44
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()`
45
45
46
46
error: you are explicitly cloning with `.map()`
47
- --> tests/ui/map_clone.rs:70 :13
47
+ --> tests/ui/map_clone.rs:71 :13
48
48
|
49
49
LL | let y = x.map(Clone::clone);
50
50
| ^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()`
51
51
52
52
error: you are explicitly cloning with `.map()`
53
- --> tests/ui/map_clone.rs:73 :13
53
+ --> tests/ui/map_clone.rs:74 :13
54
54
|
55
55
LL | let y = x.map(String::clone);
56
56
| ^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()`
57
57
58
58
error: you are explicitly cloning with `.map()`
59
- --> tests/ui/map_clone.rs:79 :13
59
+ --> tests/ui/map_clone.rs:80 :13
60
60
|
61
61
LL | let y = x.map(|x| u32::clone(x));
62
62
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()`
63
63
64
64
error: you are explicitly cloning with `.map()`
65
- --> tests/ui/map_clone.rs:82 :13
65
+ --> tests/ui/map_clone.rs:83 :13
66
66
|
67
67
LL | let y = x.map(|x| Clone::clone(x));
68
68
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()`
69
69
70
70
error: you are explicitly cloning with `.map()`
71
- --> tests/ui/map_clone.rs:94 :13
71
+ --> tests/ui/map_clone.rs:95 :13
72
72
|
73
73
LL | let y = x.map(|x| String::clone(x));
74
74
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()`
75
75
76
76
error: you are explicitly cloning with `.map()`
77
- --> tests/ui/map_clone.rs:97 :13
77
+ --> tests/ui/map_clone.rs:98 :13
78
78
|
79
79
LL | let y = x.map(|x| Clone::clone(x));
80
80
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.cloned()`
81
81
82
82
error: you are explicitly cloning with `.map()`
83
- --> tests/ui/map_clone.rs:103 :13
83
+ --> tests/ui/map_clone.rs:104 :13
84
84
|
85
85
LL | let y = x.map(|x| u32::clone(x));
86
86
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()`
87
87
88
88
error: you are explicitly cloning with `.map()`
89
- --> tests/ui/map_clone.rs:106 :13
89
+ --> tests/ui/map_clone.rs:107 :13
90
90
|
91
91
LL | let y = x.map(|x| Clone::clone(x));
92
92
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.copied()`
0 commit comments