rust-clippy/tests/ui/manual_arithmetic_check.fixed

17 lines
433 B
Rust
Raw Normal View History

#![warn(clippy::implicit_saturating_sub)]
fn main() {
let a = 12u32;
let b = 13u32;
let result = a.saturating_sub(b);
//~^ ERROR: manual arithmetic check found
let result = a.saturating_sub(b);
//~^ ERROR: manual arithmetic check found
let result = a.saturating_sub(b);
//~^ ERROR: manual arithmetic check found
let result = a.saturating_sub(b);
//~^ ERROR: manual arithmetic check found
}