1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:7:47
|
LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect();
| ^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
|
= note: `-D clippy::map-identity` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::map_identity)]`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:9:57
|
LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect();
| ^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:9:29
|
LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:12:32
|
LL | let _: Option<u8> = Some(3).map(|x| x);
| ^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:14:36
|
LL | let _: Result<i8, f32> = Ok(-3).map(|x| {
| ____________________________________^
LL | |
LL | | return x;
LL | | });
| |______^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:25:36
|
LL | let _: Result<u32, u32> = Ok(1).map_err(|a| a);
| ^^^^^^^^^^^^^^^ help: remove the call to `map_err`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:36:22
|
LL | let _ = x.clone().map(|(x, y)| (x, y));
| ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:38:22
|
LL | let _ = x.clone().map(|(x, y)| {
| ______________________^
LL | |
LL | | return (x, y);
LL | | });
| |______^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:42:22
|
LL | let _ = x.clone().map(|(x, y)| return (x, y));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:46:22
|
LL | let _ = y.clone().map(|(x, y, (z, (w,)))| (x, y, (z, (w,))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:76:30
|
LL | let _ = x.iter().copied().map(|(x, y)| (x, y));
| ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:88:15
|
LL | let _ = it.map(|x| x).next();
| ^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:93:19
|
LL | let _ = { it }.map(|x| x).next();
| ^^^^^^^^^^^ help: remove the call to `map`
error: aborting due to 13 previous errors
|