Bug Report: Clippy needless_return
incorrectly gets triggered
#10546
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
When using a match statement at the end of a function that has a return statement in a match arm and is followed by a semicolon,
cargo clippy
will suggest replacing thereturn
with a unit value. However, it does this regardless of what type the match statement actually returns, so if it is something other than unit, it breaks.Minimal reproducible example:
cargo clippy --fix
:rustc --version --verbose
:The text was updated successfully, but these errors were encountered: