about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/integer_division.rs
blob: a40956e2672e3e7869f292247fab262293aaaaf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![warn(clippy::integer_division)]

use std::num::NonZeroU32;

const TWO: NonZeroU32 = NonZeroU32::new(2).unwrap();

fn main() {
    let two = 2;
    let n = 1 / 2;
    //~^ integer_division

    let o = 1 / two;
    //~^ integer_division

    let p = two / 4;
    //~^ integer_division

    let x = 1. / 2.0;

    let a = 1;
    let s = a / TWO;
    //~^ integer_division
}