11error: unnecessary map of the identity function
2- --> tests/ui/map_identity.rs:7 :47
2+ --> tests/ui/map_identity.rs:8 :47
33 |
44LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect();
55 | ^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
@@ -8,25 +8,25 @@ LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect();
88 = help: to override `-D warnings` add `#[allow(clippy::map_identity)]`
99
1010error: unnecessary map of the identity function
11- --> tests/ui/map_identity.rs:9 :57
11+ --> tests/ui/map_identity.rs:10 :57
1212 |
1313LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect();
1414 | ^^^^^^^^^^^ help: remove the call to `map`
1515
1616error: unnecessary map of the identity function
17- --> tests/ui/map_identity.rs:9 :29
17+ --> tests/ui/map_identity.rs:10 :29
1818 |
1919LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect();
2020 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
2121
2222error: unnecessary map of the identity function
23- --> tests/ui/map_identity.rs:12 :32
23+ --> tests/ui/map_identity.rs:13 :32
2424 |
2525LL | let _: Option<u8> = Some(3).map(|x| x);
2626 | ^^^^^^^^^^^ help: remove the call to `map`
2727
2828error: unnecessary map of the identity function
29- --> tests/ui/map_identity.rs:14 :36
29+ --> tests/ui/map_identity.rs:15 :36
3030 |
3131LL | let _: Result<i8, f32> = Ok(-3).map(|x| {
3232 | ____________________________________^
@@ -36,19 +36,19 @@ LL | | });
3636 | |______^ help: remove the call to `map`
3737
3838error: unnecessary map of the identity function
39- --> tests/ui/map_identity.rs:25 :36
39+ --> tests/ui/map_identity.rs:26 :36
4040 |
4141LL | let _: Result<u32, u32> = Ok(1).map_err(|a| a);
4242 | ^^^^^^^^^^^^^^^ help: remove the call to `map_err`
4343
4444error: unnecessary map of the identity function
45- --> tests/ui/map_identity.rs:36 :22
45+ --> tests/ui/map_identity.rs:37 :22
4646 |
4747LL | let _ = x.clone().map(|(x, y)| (x, y));
4848 | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
4949
5050error: unnecessary map of the identity function
51- --> tests/ui/map_identity.rs:38 :22
51+ --> tests/ui/map_identity.rs:39 :22
5252 |
5353LL | let _ = x.clone().map(|(x, y)| {
5454 | ______________________^
@@ -58,97 +58,97 @@ LL | | });
5858 | |______^ help: remove the call to `map`
5959
6060error: unnecessary map of the identity function
61- --> tests/ui/map_identity.rs:42 :22
61+ --> tests/ui/map_identity.rs:43 :22
6262 |
6363LL | let _ = x.clone().map(|(x, y)| return (x, y));
6464 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
6565
6666error: unnecessary map of the identity function
67- --> tests/ui/map_identity.rs:46 :22
67+ --> tests/ui/map_identity.rs:47 :22
6868 |
6969LL | let _ = y.clone().map(|(x, y, (z, (w,)))| (x, y, (z, (w,))));
7070 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
7171
7272error: unnecessary map of the identity function
73- --> tests/ui/map_identity.rs:76 :30
73+ --> tests/ui/map_identity.rs:77 :30
7474 |
7575LL | let _ = x.iter().copied().map(|(x, y)| (x, y));
7676 | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
7777
7878error: unnecessary map of the identity function
79- --> tests/ui/map_identity.rs:85 :15
79+ --> tests/ui/map_identity.rs:86 :15
8080 |
8181LL | let _ = it.map(|x| x).next();
8282 | ^^^^^^^^^^^
8383 |
84- help: remove the call to `map`
84+ help: remove the call to `map`, and make `it` mutable`
8585 |
8686LL ~ let mut it = [1, 2, 3].into_iter();
8787LL ~ let _ = it.next();
8888 |
8989
9090error: unnecessary map of the identity function
91- --> tests/ui/map_identity.rs:91 :23
91+ --> tests/ui/map_identity.rs:93 :23
9292 |
9393LL | let _ = subindex.0.map(|n| n).next();
9494 | ^^^^^^^^^^^
9595 |
96- help: remove the call to `map`
96+ help: remove the call to `map`, and make `subindex` mutable`
9797 |
9898LL ~ let mut subindex = (index.by_ref().take(3), 42);
9999LL ~ let _ = subindex.0.next();
100100 |
101101
102102error: unnecessary map of the identity function
103- --> tests/ui/map_identity.rs:97 :15
103+ --> tests/ui/map_identity.rs:100 :15
104104 |
105105LL | let _ = it.map(|x| x).next();
106106 | ^^^^^^^^^^^ help: remove the call to `map`
107107
108108error: unnecessary map of the identity function
109- --> tests/ui/map_identity.rs:102 :19
109+ --> tests/ui/map_identity.rs:106 :19
110110 |
111111LL | let _ = { it }.map(|x| x).next();
112112 | ^^^^^^^^^^^ help: remove the call to `map`
113113
114114error: unnecessary map of the identity function
115- --> tests/ui/map_identity.rs:114 :30
115+ --> tests/ui/map_identity.rs:119 :30
116116 |
117117LL | let _ = x.iter().copied().map(|[x, y]| [x, y]);
118118 | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
119119
120120error: unnecessary map of the identity function
121- --> tests/ui/map_identity.rs:140 :26
121+ --> tests/ui/map_identity.rs:145 :26
122122 |
123123LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo, bar });
124124 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
125125
126126error: unnecessary map of the identity function
127- --> tests/ui/map_identity.rs:144 :26
127+ --> tests/ui/map_identity.rs:149 :26
128128 |
129129LL | let _ = x.into_iter().map(|Foo { foo, bar }| foo::Foo { foo, bar });
130130 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
131131
132132error: unnecessary map of the identity function
133- --> tests/ui/map_identity.rs:152 :26
133+ --> tests/ui/map_identity.rs:157 :26
134134 |
135135LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: foo, bar: bar });
136136 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
137137
138138error: unnecessary map of the identity function
139- --> tests/ui/map_identity.rs:156 :26
139+ --> tests/ui/map_identity.rs:161 :26
140140 |
141141LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { bar, foo });
142142 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
143143
144144error: unnecessary map of the identity function
145- --> tests/ui/map_identity.rs:166 :26
145+ --> tests/ui/map_identity.rs:171 :26
146146 |
147147LL | let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(foo, bar));
148148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
149149
150150error: unnecessary map of the identity function
151- --> tests/ui/map_identity.rs:170 :26
151+ --> tests/ui/map_identity.rs:175 :26
152152 |
153153LL | let _ = x.into_iter().map(|Foo2(foo, bar)| foo::Foo2(foo, bar));
154154 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
0 commit comments