You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lint can flag match that return option and that are directly followed by a return in case of None with/without error mapping. They could be factorized to not return an option and return directly the error he is mapped to.
Lint Name
match_return_too_complex
Category
style, complexity
Advantage
Simplify the code by removing a combinator call
Drawbacks
No response
Example
let a = matchself.block_statuses.get(&cur_h){Some(block) => Some(block.id),
_ => None,}.ok_or_else(|| "Error".to_string())?;
Could be written as:
let a = matchself.block_statuses.get(&cur_h){Some(block) => block.id,
_ => returnErr("Error".to_string()),};
The text was updated successfully, but these errors were encountered:
What it does
This lint can flag
match
that return option and that are directly followed by a return in case ofNone
with/without error mapping. They could be factorized to not return an option and return directly the error he is mapped to.Lint Name
match_return_too_complex
Category
style, complexity
Advantage
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: