fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.6 KiB77 linesraw
1error: operator precedence can trip the unwary
2  --> $DIR/precedence.rs:16:5
3   |
4LL |     1 << 2 + 3;
5   |     ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)`
6   |
7   = note: `-D clippy::precedence` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::precedence)]`
9
10error: operator precedence can trip the unwary
11  --> $DIR/precedence.rs:17:5
12   |
13LL |     1 + 2 << 3;
14   |     ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3`
15
16error: operator precedence can trip the unwary
17  --> $DIR/precedence.rs:18:5
18   |
19LL |     4 >> 1 + 1;
20   |     ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)`
21
22error: operator precedence can trip the unwary
23  --> $DIR/precedence.rs:19:5
24   |
25LL |     1 + 3 >> 2;
26   |     ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2`
27
28error: operator precedence can trip the unwary
29  --> $DIR/precedence.rs:20:5
30   |
31LL |     1 ^ 1 - 1;
32   |     ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)`
33
34error: operator precedence can trip the unwary
35  --> $DIR/precedence.rs:21:5
36   |
37LL |     3 | 2 - 1;
38   |     ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)`
39
40error: operator precedence can trip the unwary
41  --> $DIR/precedence.rs:22:5
42   |
43LL |     3 & 5 - 2;
44   |     ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)`
45
46error: unary minus has lower precedence than method call
47  --> $DIR/precedence.rs:23:5
48   |
49LL |     -1i32.abs();
50   |     ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())`
51
52error: unary minus has lower precedence than method call
53  --> $DIR/precedence.rs:24:5
54   |
55LL |     -1f32.abs();
56   |     ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())`
57
58error: unary minus has lower precedence than method call
59  --> $DIR/precedence.rs:51:13
60   |
61LL |     let _ = -1.0_f64.cos().cos();
62   |             ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.cos().cos())`
63
64error: unary minus has lower precedence than method call
65  --> $DIR/precedence.rs:52:13
66   |
67LL |     let _ = -1.0_f64.cos().sin();
68   |             ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.cos().sin())`
69
70error: unary minus has lower precedence than method call
71  --> $DIR/precedence.rs:53:13
72   |
73LL |     let _ = -1.0_f64.sin().cos();
74   |             ^^^^^^^^^^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1.0_f64.sin().cos())`
75
76error: aborting due to 12 previous errors
77