check for if-some-or-ok-else-none-or-err#8696
Conversation
|
r? @flip1995 (rust-highfive has picked a reviewer for you, use r? to override) |
|
☔ The latest upstream changes (presumably #8705) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Well... I forgor that I did for this PR already, may I request a feedback anyway? @flip1995 |
|
|
|
I think this should only check for arms that span a single line. I don't think going from let _ = match res {
Err(_) => 1,
Ok(mut a) => {
a += 1;
println!("{a}");
a -= 1;
let b = 5;
a += b;
a
}
};to let _ = res.map_or(1, |mut a| {
a += 1;
println!("{a}");
a -= 1;
let b = 5;
a += b;
a
});makes much of a difference. |
and add test case for `Result`
|
Thanks! Sorry for taking so long. I rebased it and did a minor cleanup. About the lint name: Yes it will need to be changed. But since this lint is currently in @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fixes: #8492
changelog: make [
option_if_let_else] to check for match expression with both Option and Result; TODO: Change lint name? Add new lint with similar functionality?