blob: 8d19d62cdc64116b8674a6a58d2afe5f7859eb81 [file] [log] [blame] [edit]
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:8: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:10: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:10: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:13: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:15: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:26: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:37: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:39: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:43: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:47: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:77: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:86:15
|
LL | let _ = it.map(|x| x).next();
| ^^^^^^^^^^^
|
help: remove the call to `map`, and make `it` mutable
|
LL ~ let mut it = [1, 2, 3].into_iter();
LL ~ let _ = it.next();
|
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:93:23
|
LL | let _ = subindex.0.map(|n| n).next();
| ^^^^^^^^^^^
|
help: remove the call to `map`, and make `subindex` mutable
|
LL ~ let mut subindex = (index.by_ref().take(3), 42);
LL ~ let _ = subindex.0.next();
|
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:100: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:106:19
|
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:119: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:145:26
|
LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo, bar });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:149:26
|
LL | let _ = x.into_iter().map(|Foo { foo, bar }| foo::Foo { foo, bar });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:157:26
|
LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: foo, bar: bar });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:161:26
|
LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { bar, foo });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:171:26
|
LL | let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(foo, bar));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: unnecessary map of the identity function
--> tests/ui/map_identity.rs:175:26
|
LL | let _ = x.into_iter().map(|Foo2(foo, bar)| foo::Foo2(foo, bar));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map`
error: aborting due to 22 previous errors