mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Merge pull request #1652 from pgerber/with
correct message for `option_map_unwrap_or_else` lint
This commit is contained in:
commit
60f4863cbe
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user