-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Spurious irrefutable_let_patterns warning with let-chain #139369
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-irrefutable_let_patternsLint: irrefutable_let_patternsLint: irrefutable_let_patternsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-irrefutable_let_patternsLint: irrefutable_let_patternsLint: irrefutable_let_patternsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
Rationale and extra context
This code naturally expresses "please call that function and then do something if the return value satisfies a condition". Putting the
letbinding outside theifwould be bad as then it remains in scope after theif, which is not the intent. I could wrap it in an extra layer of curly braces but that increases the overall indentation level.I think this warning should never trigger for let chains.
Other cases
Rust Version
Anything else?
No response