unit_arg suggestions don't make sense when run against Option::map_or(unit_expr, ...) #5823
Labels
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
L-suggestion
Lint: Improving, adding or fixing lint suggestions
(For context, this is the code after taking the code in #5821 and applying
clippy::option_if_let_else
's suggestion.)The lint's suggestion is:
I'm not sure what the first suggestion is trying to say.
The second suggestion is removing the call to
g
entirely, which is definitely wrong.Note that the expectation of this code was that it would actually trigger
clippy::or_fun_call
to suggesto.map_or_else(|| g(), |i| f(i))
(as mentioned in #5821), so the problem is not only that it ended up triggeringclippy::unit_arg
instead but also that the suggestions don't make sense.Meta
cargo clippy -V
:clippy 0.0.212 (39d5a61 2020-07-17)
rustc -Vv
:The text was updated successfully, but these errors were encountered: