-
Notifications
You must be signed in to change notification settings - Fork 2k
collapsible_match suggestion change meaning #16875
Copy link
Copy link
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-bugIssue: The suggestion compiles but changes the code to behave in an unintended wayIssue: The suggestion compiles but changes the code to behave in an unintended way
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-bugIssue: The suggestion compiles but changes the code to behave in an unintended wayIssue: The suggestion compiles but changes the code to behave in an unintended way
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Code in the form
pattern => {if test {…}}is suggested to be simplified aspattern if test => {…}but the meaning is different: if the pattern match but not the test, no other pattern are checked in the original code, but other patterns are checked in the suggestion.Lint Name
collapsible_match
Reproducer
Corrected code should have the same result as the original code, here is an example showing it is false:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=c5e9555641490ea06f6588cd501e1233
Version
Additional Labels
No response