-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
What it does
Add lint similar to IMPLICIT_SATURATING_SUB
, but for ADD
. So it will be IMPLICIT_SATURATING_ADD
Lint Name
IMPLICIT_SATURATING_ADD
Category
pedantic
Advantage
No response
Drawbacks
No response
Example
#![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);
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy