We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fn get_result(b: bool) -> Result<(u16, u16), String> { if b { Ok((42, 1337)) } else { Err("oh no".to_string()) } } fn main() { let (_, _) = match get_result(false) { Err(_) => (0, 0), Ok((x, y)) => (x, y), }; //println!("a: {}, b: {}", a, b); }
the match of the main function can be simplified to
match
let (_, _) = match get_result(false) { Ok((x, y)) => (x, y), _ => (0,0), };
The text was updated successfully, but these errors were encountered:
This should be allow by default.
Sorry, something went wrong.
It could be put into the pedantic group.
IMO this would have to be restriction. The Err adds clarity. I also like putting the error case (or the "unhappy path") first in general.
Err
No branches or pull requests
the
match
of the main function can be simplified toThe text was updated successfully, but these errors were encountered: