about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-18 02:49:29 +0000
committerbors <bors@rust-lang.org>2020-11-18 02:49:29 +0000
commit8c2e2fd4ec55e41afb0ea15497adce1166476c8f (patch)
tree8f95165c4654038c8475ae7ddbe92d33a019d1ea
parent44d944586c5a505890b18bc6cac4e3cd91c46c25 (diff)
parent0502ac2a87458620ae83e5260fd13149a558e090 (diff)
downloadrust-8c2e2fd4ec55e41afb0ea15497adce1166476c8f.tar.gz
rust-8c2e2fd4ec55e41afb0ea15497adce1166476c8f.zip
Auto merge of #6340 - giraffate:improve_doc_for_map_clone, r=Manishearth
Improve doc about `map_clone`

A follow up of https://github.com/rust-lang/rust-clippy/issues/6239#issuecomment-719100677.

`map_clone` works with not only `Iterator` but `Option` although not written in [doc](https://rust-lang.github.io/rust-clippy/master/#map_clone). Also, an example in the doc shows  a usage of dereferencing, but this isn't also written.

changelog: Improve doc about `map_clone`
-rw-r--r--clippy_lints/src/map_clone.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs
index 3f34dd5112e..220240acb7a 100644
--- a/clippy_lints/src/map_clone.rs
+++ b/clippy_lints/src/map_clone.rs
@@ -14,8 +14,9 @@ use rustc_span::symbol::Ident;
 use rustc_span::{sym, Span};
 
 declare_clippy_lint! {
-    /// **What it does:** Checks for usage of `iterator.map(|x| x.clone())` and suggests
-    /// `iterator.cloned()` instead
+    /// **What it does:** Checks for usage of `map(|x| x.clone())` or
+    /// dereferencing closures for `Copy` types, on `Iterator` or `Option`,
+    /// and suggests `cloned()` or `copied()` instead
     ///
     /// **Why is this bad?** Readability, this can be written more concisely
     ///