Open
Description
openedon Jun 18, 2024
Description
Basically, both manual_unwrap_or_default
and manual_unwrap_or
work on the same scenarios with the only difference being what they search on the else
expression: if it's equivalent to a default() call, lint manual_unwrap_or_default
, otherwise manual_unwrap_or
.
Right now we have the situation where we might lint twice over the same code, for instance if we have
let x: Option<i32> = None;
match x {
Some(v) => v,
None => 0,
};
both lints could be fired.
If we change to have them at the same file, we can decide to lint just one or the other depending on the else
expression and whether or not manual_unwrap_or_default
is allowed (since it is more specific: a subset of manual_unwrap_or
)
So, in the end, it will be something like:
- Is the
else
a default andmanual_unwrap_or_default
is not allowed: Lintmanual_unwrap_or_default
- Otherwise (meaning that it is not a default OR it is but
manual_unwrap_or_default
is allowed): Lintmanual_unwrap_or
Version
No response
Additional Labels
No response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment