Open
Description
What it does
Detects the combination of then_some
followed by unwrap_or
in place of a more clear if
/else
.
Lint Name
bool_if_else
Category
style
Advantage
- Clarity at a glance
Drawbacks
No response
Example
let mode = executable.then_some(IsExecutable).unwrap_or(IsNotExecutable);
Could be written as:
let mode = if executable { IsExecutable } else { IsNotExecutable };