mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
9a2c50f3d6
Add macro check to precedence lint
58 lines
1.8 KiB
Text
58 lines
1.8 KiB
Text
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:18:5
|
|
|
|
|
18 | 1 << 2 + 3;
|
|
| ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)`
|
|
|
|
|
= note: `-D precedence` implied by `-D warnings`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:19:5
|
|
|
|
|
19 | 1 + 2 << 3;
|
|
| ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:20:5
|
|
|
|
|
20 | 4 >> 1 + 1;
|
|
| ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:21:5
|
|
|
|
|
21 | 1 + 3 >> 2;
|
|
| ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:22:5
|
|
|
|
|
22 | 1 ^ 1 - 1;
|
|
| ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:23:5
|
|
|
|
|
23 | 3 | 2 - 1;
|
|
| ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)`
|
|
|
|
error: operator precedence can trip the unwary
|
|
--> $DIR/precedence.rs:24:5
|
|
|
|
|
24 | 3 & 5 - 2;
|
|
| ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)`
|
|
|
|
error: unary minus has lower precedence than method call
|
|
--> $DIR/precedence.rs:25:5
|
|
|
|
|
25 | -1i32.abs();
|
|
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())`
|
|
|
|
error: unary minus has lower precedence than method call
|
|
--> $DIR/precedence.rs:26:5
|
|
|
|
|
26 | -1f32.abs();
|
|
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|