rust-clippy/tests/ui/manual_div_ceil_with_feature.fixed

25 lines
503 B
Rust

#![warn(clippy::manual_div_ceil)]
#![feature(int_roundings)]
fn main() {
let x = 7_i32;
let y = 4_i32;
let z = 3_i32;
let z_u: u32 = 11;
// Lint.
let _ = x.div_ceil(y);
let _ = x.div_ceil(y);
let _ = x.div_ceil(y);
let _ = 7_i32.div_ceil(4);
let _ = (7_i32 as u32).div_ceil(4);
let _ = (7_u32 as i32).div_ceil(4);
let _ = z_u.div_ceil(4);
// No lint.
let _ = (x + (y - 2)) / y;
let _ = (x + (y + 1)) / y;
let _ = (x + (y - 1)) / z;
}