Closed
Description
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?
Might be a byproduct of #4220
clippy 0.0.212 (e3cb40e 2019-06-25)