]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/arithmetic.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / arithmetic.rs
CommitLineData
abe05a73
XL
1
2
ea8adc8c
XL
3
4#![warn(integer_arithmetic, float_arithmetic)]
5#![allow(unused, shadow_reuse, shadow_unrelated, no_effect, unnecessary_operation)]
6fn main() {
7 let i = 1i32;
8 1 + i;
9 i * 2;
10 1 %
11 i / 2; // no error, this is part of the expression in the preceding line
12 i - 2 + 2 - i;
13 -i;
14
15 i & 1; // no wrapping
16 i | 1;
17 i ^ 1;
18 i >> 1;
19 i << 1;
20
21 let f = 1.0f32;
22
23 f * 2.0;
24
25 1.0 + f;
26 f * 2.0;
27 f / 2.0;
28 f - 2.0 * 4.2;
29 -f;
30}