about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-23 15:59:27 +0000
committerbors <bors@rust-lang.org>2020-06-23 15:59:27 +0000
commit583d64493484f72425ecac55eaf5eddbba10b132 (patch)
tree4a7fa7bc487a502fc1d969ed2f80a844f948d12a /src
parentc2c07fa9d095931eb5684a42942a7b573a0c5238 (diff)
parentfb4f9a0ad7a4656beb01c85b02b3e6ef15d914ec (diff)
downloadrust-583d64493484f72425ecac55eaf5eddbba10b132.tar.gz
rust-583d64493484f72425ecac55eaf5eddbba10b132.zip
Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
#5626: lint iterator.map(|x| x)

changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626)

The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.
Diffstat (limited to 'src')
-rw-r--r--src/lintlist/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index edceb755180..5a43a1a07d2 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -1145,6 +1145,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "methods",
     },
     Lint {
+        name: "map_identity",
+        group: "complexity",
+        desc: "using iterator.map(|x| x)",
+        deprecation: None,
+        module: "map_identity",
+    },
+    Lint {
         name: "map_unwrap_or",
         group: "pedantic",
         desc: "using `.map(f).unwrap_or(a)` or `.map(f).unwrap_or_else(func)`, which are more succinctly expressed as `map_or(a, f)` or `map_or_else(a, f)`",