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,76 +58,100 @@ 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:88:15
79+ --> tests/ui/map_identity.rs:86:15
80+ |
81+ LL | let _ = it.map(|x| x).next();
82+ | ^^^^^^^^^^^
83+ |
84+ help: remove the call to `map`, and make `it` mutable
85+ |
86+ LL ~ let mut it = [1, 2, 3].into_iter();
87+ LL ~ let _ = it.next();
88+ |
89+
90+ error: unnecessary map of the identity function
91+ --> tests/ui/map_identity.rs:93:23
92+ |
93+ LL | let _ = subindex.0.map(|n| n).next();
94+ | ^^^^^^^^^^^
95+ |
96+ help: remove the call to `map`, and make `subindex` mutable
97+ |
98+ LL ~ let mut subindex = (index.by_ref().take(3), 42);
99+ LL ~ let _ = subindex.0.next();
100+ |
101+
102+ error: unnecessary map of the identity function
103+ --> tests/ui/map_identity.rs:100:15
80104 |
81105LL | let _ = it.map(|x| x).next();
82106 | ^^^^^^^^^^^ help: remove the call to `map`
83107
84108error: unnecessary map of the identity function
85- --> tests/ui/map_identity.rs:93 :19
109+ --> tests/ui/map_identity.rs:106 :19
86110 |
87111LL | let _ = { it }.map(|x| x).next();
88112 | ^^^^^^^^^^^ help: remove the call to `map`
89113
90114error: unnecessary map of the identity function
91- --> tests/ui/map_identity.rs:105 :30
115+ --> tests/ui/map_identity.rs:119 :30
92116 |
93117LL | let _ = x.iter().copied().map(|[x, y]| [x, y]);
94118 | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
95119
96120error: unnecessary map of the identity function
97- --> tests/ui/map_identity.rs:131 :26
121+ --> tests/ui/map_identity.rs:145 :26
98122 |
99123LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo, bar });
100124 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
101125
102126error: unnecessary map of the identity function
103- --> tests/ui/map_identity.rs:135 :26
127+ --> tests/ui/map_identity.rs:149 :26
104128 |
105129LL | let _ = x.into_iter().map(|Foo { foo, bar }| foo::Foo { foo, bar });
106130 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
107131
108132error: unnecessary map of the identity function
109- --> tests/ui/map_identity.rs:143 :26
133+ --> tests/ui/map_identity.rs:157 :26
110134 |
111135LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: foo, bar: bar });
112136 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
113137
114138error: unnecessary map of the identity function
115- --> tests/ui/map_identity.rs:147 :26
139+ --> tests/ui/map_identity.rs:161 :26
116140 |
117141LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { bar, foo });
118142 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
119143
120144error: unnecessary map of the identity function
121- --> tests/ui/map_identity.rs:157 :26
145+ --> tests/ui/map_identity.rs:171 :26
122146 |
123147LL | let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(foo, bar));
124148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
125149
126150error: unnecessary map of the identity function
127- --> tests/ui/map_identity.rs:161 :26
151+ --> tests/ui/map_identity.rs:175 :26
128152 |
129153LL | let _ = x.into_iter().map(|Foo2(foo, bar)| foo::Foo2(foo, bar));
130154 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
131155
132- error: aborting due to 20 previous errors
156+ error: aborting due to 22 previous errors
133157
0 commit comments