Skip to content

Added identity_assign_op lint#17038

Open
JaafarTanoukhi wants to merge 2 commits into
rust-lang:masterfrom
JaafarTanoukhi:new-lint-identity-assign-op
Open

Added identity_assign_op lint#17038
JaafarTanoukhi wants to merge 2 commits into
rust-lang:masterfrom
JaafarTanoukhi:new-lint-identity-assign-op

Conversation

@JaafarTanoukhi
Copy link
Copy Markdown

changelog: [identity_assign_op]: new lint

fixes #16977

@rustbot rustbot added needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 19, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 19, 2026

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, llogiq, samueltardieu

Copy link
Copy Markdown
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few problems with this proposed implementation:

  • Ignoring the statement means removing it, not just replacing it with the LHS expression.
  • Why is there a TODO in the source?
  • User types may implement those operators, and they might not be removable because they can contain side effects.
  • Floating points types are ignored.
  • Even if the snippet cannot be retrieved, the lint is currently marked MachineApplicable which is not true.
  • Tests involving macros should be added.

@rustbot author

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 20, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@oscargus
Copy link
Copy Markdown
Contributor

In the original issue there was a suggestion to focus on that this may be a bug, rather than that it can be simplified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect assignment operators that do nothing (e.g. += 0)

5 participants