correct error message for `option_map_unwrap_or_else` lint

Remove erroneous "with " in suggested alternative call.
This commit is contained in:
Peter Gerber 2017-04-01 15:49:55 +02:00
parent 9c3c938761
commit 71a788cbd7
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