Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Jan 9, 2026

  • add missing tests and fix previously uncaught regressions
  • respect reduced applicability
  • simplify lint logic

changelog: [int_plus_one]: respect reduced applicability
changelog: [int_plus_one]: fix FN with negative literals, e.g. -1 + x <= y

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 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

By building the whole suggestion in `emit_suggestion`, we avoid the need
to thread `Applicability` through `check_binop` into
`generate_suggestion`
Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

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

This is already quite good, I merely have a few nits.

View changes since this review

Comment on lines 98 to 104
if Self::is_one(rhslhs) {
Some((lhs, rhsrhs))
} else if Self::is_one(rhsrhs) {
Some((lhs, rhslhs))
} else {
None
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could factor that out into a function we can call with lhs, rhslhs, rhsrhs and below with rhs, lhslhs, lhsrhs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought I could go one step further and create a function for x-1 as well -- do let me know if you think that overabstracts it

Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

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

@llogiq llogiq added this pull request to the merge queue Jan 11, 2026
Merged via the queue into rust-lang:master with commit bcd52c1 Jan 11, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 11, 2026
@ada4a ada4a deleted the int_plus_one branch January 11, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants