We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
IMPLICIT_SATURATING_ADD
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add lint similar to IMPLICIT_SATURATING_SUB, but for ADD. So it will be IMPLICIT_SATURATING_ADD
IMPLICIT_SATURATING_SUB
ADD
pedantic
No response
#![warn(clippy::implicit_saturating_add)] fn main() { let mut i: u32 = 3; if i != MAX { i += 1; } println!("{}", i); }
Could be written as:
#![warn(clippy::implicit_saturating_add)] fn main() { let mut i: u32 = 3; if i != MAX { i = i.saturating_add(1); } println!("{}", i); }
The text was updated successfully, but these errors were encountered:
I'm assume you mean if i !=MAX { i += 1 } to i = i.saturating_add(1).
if i !=MAX { i += 1 }
i = i.saturating_add(1)
Sorry, something went wrong.
@rustbot claim
implicit_saturating_add
09e6c23
roynrishingha
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
What it does
Add lint similar to
IMPLICIT_SATURATING_SUB
, but forADD
. So it will beIMPLICIT_SATURATING_ADD
Lint Name
IMPLICIT_SATURATING_ADD
Category
pedantic
Advantage
No response
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: