mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Auto merge of #5070 - JohnTitor:suspicious-map-doc, r=flip1995
Improve `suspicious_map`documentation Fixes #4793 changelog: none
This commit is contained in:
commit
32949da78e
2 changed files with 4 additions and 3 deletions
|
@ -1041,7 +1041,8 @@ declare_clippy_lint! {
|
|||
/// **What it does:** Checks for calls to `map` followed by a `count`.
|
||||
///
|
||||
/// **Why is this bad?** It looks suspicious. Maybe `map` was confused with `filter`.
|
||||
/// If the `map` call is intentional, this should be rewritten.
|
||||
/// If the `map` call is intentional, this should be rewritten. Or, if you intend to
|
||||
/// drive the iterator to completion, you can just use `for_each` instead.
|
||||
///
|
||||
/// **Known problems:** None
|
||||
///
|
||||
|
@ -3014,7 +3015,7 @@ fn lint_suspicious_map(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>) {
|
|||
SUSPICIOUS_MAP,
|
||||
expr.span,
|
||||
"this call to `map()` won't have an effect on the call to `count()`",
|
||||
"make sure you did not confuse `map` with `filter`",
|
||||
"make sure you did not confuse `map` with `filter` or `for_each`",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _ = (0..3).map(|x| x + 2).count();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::suspicious-map` implied by `-D warnings`
|
||||
= help: make sure you did not confuse `map` with `filter`
|
||||
= help: make sure you did not confuse `map` with `filter` or `for_each`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
Loading…
Reference in a new issue