mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
25 lines
503 B
Rust
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;
|
|
}
|