-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix if_same_then_else false positive #3590
Conversation
Don't understand how my change causes build failure. Should I address these errors in this PR?
|
You probably just have an outdated master branch. If you rebase over the master branch of this repository, everything should work again |
It's upstream breakage, rust-lang/rust#56999 was merged last night. |
Fixed in #3591 |
☔ The latest upstream changes (presumably #3587) made this pull request unmergeable. Please resolve the merge conflicts. |
bc93633
to
aebc9d9
Compare
tests/ui/copies.rs
Outdated
@@ -335,6 +335,17 @@ fn if_same_then_else() -> Result<&'static str, ()> { | |||
let foo = ""; | |||
return Ok(&foo[0..]); | |||
} | |||
|
|||
// See #3559 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd like this line to be slightly more descriptive, something like
// false positive if_same_then_else, let(x,y) vs let(y,x), see #3559
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed that. Thanks for feedback!
aebc9d9
to
911a752
Compare
@bors r+ thanks! |
📌 Commit 911a752 has been approved by |
Fix if_same_then_else false positive This fixes false positive in #3559. The problem was that `SpanlessEq` does not check patterns in declarations. So this two blocks considered equal. ```rust if true { let (x, y) = foo(); } else { let (y, x) = foo(); } ``` Not sure if the proposed change is safe as `SpanlessEq` is used extensively in other lints, but I tried hard to come up with counterexample and failed.
☀️ Test successful - status-appveyor, status-travis |
This fixes false positive in #3559.
The problem was that
SpanlessEq
does not check patterns in declarations. So this two blocks considered equal.Not sure if the proposed change is safe as
SpanlessEq
is used extensively in other lints, but I tried hard to come up with counterexample and failed.