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
pub fn fun(a: i32) { match a { 1 => return, 2 => { println!("false"); } _ => {} } }
this code warns:
warning: unneeded return statement --> src/main.rs:5:14 | 5 | 1 => return, | ^^^^^^ help: replace `return` with the unit type: `()` | = note: #[warn(clippy::needless_return)] on by default
but equivalent code
pub fn fun(a: i32) { match a { 1 => { return; } 2 => { println!("false"); } _ => {} } }
warns
warning: unneeded return statement --> src/main.rs:6:13 | 6 | return; | ^^^^^^^ help: remove `return` | = note: #[warn(clippy::needless_return)] on by default
IMO, suggesting x => (), is strange and I would rather have x => {}, suggested in both cases, so maybe we could unify this?
x => (),
x => {},
Might be a byproduct of #4220 clippy 0.0.212 (e3cb40e 2019-06-25)
clippy 0.0.212 (e3cb40e 2019-06-25)
The text was updated successfully, but these errors were encountered:
Auto merge of #4262 - bara86:master, r=flip1995
1987bf7
Use empty block instead of unit type for needless return fixes #4238 changelog: Use empty block instead of unit type for needless return
Successfully merging a pull request may close this issue.
this code warns:
but equivalent code
warns
IMO, suggesting
x => (),
is strange and I would rather havex => {},
suggested in both cases, so maybe we could unify this?Might be a byproduct of #4220
clippy 0.0.212 (e3cb40e 2019-06-25)
The text was updated successfully, but these errors were encountered: