Skip to content
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

Warn about useless assignments of variables/fields to themselves #87129

Merged
merged 1 commit into from
Jul 18, 2021

Conversation

FabianWolff
Copy link
Contributor

This PR fixes #75356. Following @varkor's suggestion in #75356 (comment), I have implemented this warning as part of the dead_code lint. Unlike the -Wself-assign implementation in Clang, my implementation also warns about self-assignments of struct fields (s.x = s.x).

r? @varkor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2021
@rust-log-analyzer

This comment has been minimized.

@varkor
Copy link
Member

varkor commented Jul 17, 2021

Thanks, this looks good!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2021

📌 Commit dc639c9 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 17, 2021
@bors
Copy link
Contributor

bors commented Jul 17, 2021

⌛ Testing commit dc639c9 with merge eb0b95b...

@bors
Copy link
Contributor

bors commented Jul 18, 2021

☀️ Test successful - checks-actions
Approved by: varkor
Pushing eb0b95b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 18, 2021
@bors bors merged commit eb0b95b into rust-lang:master Jul 18, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Superfluous assignment does not give warning
6 participants