Open Thechi2000 opened 1 year ago
Shrunk example:
fn func(input: u8) {
match input {
3 => 4,
_ => {
// side effect ...
return;
},
};
}
Produces:
warning: unneeded `return` statement
--> src/lib.rs:5:27
|
5 | // side effect ...
| _______________________________^
6 | | return;
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
= help: remove `return`
I ran
cargo clippy --fix
on my project, and it failed with the following output:Reproduction:
I was working on this project, on the commit e5087b1591032157c90d28e7925e5282df8456eb
Versions: rustup: 1.25.1 rustc: 1.66.0 cargo: 1.66.0 clippy: 0.1.66
Issue
The problem is that clippy considers that the return at
src-tauri/src/login/microsoft/mod.rs:119
is unneeded, but it actually makes the function return at the end of the match arm, thus the arm does not need to return aWindow<Wry>
. When clippy removes it, the second arms return()
, thus it is incompatible with the first one (which returnsWindow<Wry>
).