Merge pull request #1652 from pgerber/with

correct message for `option_map_unwrap_or_else` lint
This commit is contained in:
Martin Carton 2017-04-02 00:54:40 +02:00 committed by GitHub
commit 60f4863cbe
2 changed files with 2 additions and 2 deletions

View File

@ -1101,7 +1101,7 @@ fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::
expr.span,
msg,
expr.span,
&format!("replace `map({0}).unwrap_or_else({1})` with `with map_or_else({1}, {0})`",
&format!("replace `map({0}).unwrap_or_else({1})` with `map_or_else({1}, {0})`",
map_snippet,
unwrap_snippet));
} else if same_span && multiline {

View File

@ -117,7 +117,7 @@ note: lint level defined here
|
5 | #![deny(clippy, clippy_pedantic)]
| ^^^^^^^^^^^^^^^
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `with map_or_else(|| 0, |x| x + 1)`
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
--> $DIR/methods.rs:120:13