-
Notifications
You must be signed in to change notification settings - Fork 2k
False positive for let_and_return #16820
Copy link
Copy link
Open
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
Seems like it doesn't account for
let-elsestatements which meaningfully change program logicLint Name
let_and_return
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warning, the let binding is necessary
Version
Additional Labels
@rustbot label +I-suggestion-causes-bug