Skip to content

Conversation

AMS21
Copy link

@AMS21 AMS21 commented Oct 6, 2025

changelog: new lint: [unsigned_subtraction_gt_zero] Lints comparisons of an unsigned integer subtraction against zero, like (a - b) > 0.

If a < b, a - b will panic in debug builds and wrap in release builds, making the effectively behave like a != b. This is likely unintended; a > b is clearer avoids potential panics and wraparound.

Fixes #588

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
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

Copy link

github-actions bot commented Oct 6, 2025

Lintcheck changes for 3c7f816

Lint Added Removed Changed
clippy::unsigned_subtraction_gt_zero 1 0 0

This comment will be updated if you push new changes

@AMS21 AMS21 force-pushed the unsigned_subtraction_gt_zero branch from 59419d1 to 3c7f816 Compare October 6, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint unsigned - other_unsigned > 0
3 participants