]> git.lizzy.rs Git - rust.git/blob - tests/ui/identity_op.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / identity_op.rs
1 #![feature(tool_lints)]
2
3
4 const ONE : i64 = 1;
5 const NEG_ONE : i64 = -1;
6 const ZERO : i64 = 0;
7
8 #[allow(clippy::eq_op, clippy::no_effect, clippy::unnecessary_operation, clippy::double_parens)]
9 #[warn(clippy::identity_op)]
10 fn main() {
11     let x = 0;
12
13     x + 0;
14     x + (1 - 1);
15     x + 1;
16     0 + x;
17     1 + x;
18     x - ZERO;     //no error, as we skip lookups (for now)
19     x | (0);
20     ((ZERO)) | x; //no error, as we skip lookups (for now)
21
22     x * 1;
23     1 * x;
24     x / ONE;      //no error, as we skip lookups (for now)
25
26     x / 2;        //no false positive
27
28     x & NEG_ONE;  //no error, as we skip lookups (for now)
29     -1 & x;
30
31     let u : u8 = 0;
32     u & 255;
33 }