Skip to content

Commit 8c2e2fd

Browse files
committed
Auto merge of rust-lang#6340 - giraffate:improve_doc_for_map_clone, r=Manishearth
Improve doc about `map_clone` A follow up of rust-lang/rust-clippy#6239 (comment). `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`
2 parents 44d9445 + 0502ac2 commit 8c2e2fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/map_clone.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ use rustc_span::symbol::Ident;
1414
use rustc_span::{sym, Span};
1515

1616
declare_clippy_lint! {
17-
/// **What it does:** Checks for usage of `iterator.map(|x| x.clone())` and suggests
18-
/// `iterator.cloned()` instead
17+
/// **What it does:** Checks for usage of `map(|x| x.clone())` or
18+
/// dereferencing closures for `Copy` types, on `Iterator` or `Option`,
19+
/// and suggests `cloned()` or `copied()` instead
1920
///
2021
/// **Why is this bad?** Readability, this can be written more concisely
2122
///

0 commit comments

Comments
 (0)