mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
clean tests/ui/precedence.rs
Cleaning the empty lines for clarity.
This commit is contained in:
parent
69139facb2
commit
ec343e1524
3 changed files with 31 additions and 51 deletions
|
@ -9,7 +9,6 @@ struct Foo;
|
||||||
impl PartialEq for Foo {
|
impl PartialEq for Foo {
|
||||||
fn eq(&self, _: &Foo) -> bool { true }
|
fn eq(&self, _: &Foo) -> bool { true }
|
||||||
fn ne(&self, _: &Foo) -> bool { false }
|
fn ne(&self, _: &Foo) -> bool { false }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -6,34 +6,15 @@
|
||||||
#[allow(eq_op)]
|
#[allow(eq_op)]
|
||||||
fn main() {
|
fn main() {
|
||||||
1 << 2 + 3;
|
1 << 2 + 3;
|
||||||
|
|
||||||
|
|
||||||
1 + 2 << 3;
|
1 + 2 << 3;
|
||||||
|
|
||||||
|
|
||||||
4 >> 1 + 1;
|
4 >> 1 + 1;
|
||||||
|
|
||||||
|
|
||||||
1 + 3 >> 2;
|
1 + 3 >> 2;
|
||||||
|
|
||||||
|
|
||||||
1 ^ 1 - 1;
|
1 ^ 1 - 1;
|
||||||
|
|
||||||
|
|
||||||
3 | 2 - 1;
|
3 | 2 - 1;
|
||||||
|
|
||||||
|
|
||||||
3 & 5 - 2;
|
3 & 5 - 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-1i32.abs();
|
-1i32.abs();
|
||||||
|
|
||||||
|
|
||||||
-1f32.abs();
|
-1f32.abs();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// These should not trigger an error
|
// These should not trigger an error
|
||||||
let _ = (-1i32).abs();
|
let _ = (-1i32).abs();
|
||||||
let _ = (-1f32).abs();
|
let _ = (-1f32).abs();
|
||||||
|
|
|
@ -10,52 +10,52 @@ note: lint level defined here
|
||||||
4 | #[deny(precedence)]
|
4 | #[deny(precedence)]
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
|
error: operator precedence can trip the unwary
|
||||||
|
--> $DIR/precedence.rs:9:5
|
||||||
|
|
|
||||||
|
9 | 1 + 2 << 3;
|
||||||
|
| ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 2) << 3`
|
||||||
|
|
||||||
|
error: operator precedence can trip the unwary
|
||||||
|
--> $DIR/precedence.rs:10:5
|
||||||
|
|
|
||||||
|
10 | 4 >> 1 + 1;
|
||||||
|
| ^^^^^^^^^^ help: consider parenthesizing your expression `4 >> (1 + 1)`
|
||||||
|
|
||||||
error: operator precedence can trip the unwary
|
error: operator precedence can trip the unwary
|
||||||
--> $DIR/precedence.rs:11:5
|
--> $DIR/precedence.rs:11:5
|
||||||
|
|
|
|
||||||
11 | 1 + 2 << 3;
|
11 | 1 + 3 >> 2;
|
||||||
| ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 2) << 3`
|
| ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 3) >> 2`
|
||||||
|
|
||||||
|
error: operator precedence can trip the unwary
|
||||||
|
--> $DIR/precedence.rs:12:5
|
||||||
|
|
|
||||||
|
12 | 1 ^ 1 - 1;
|
||||||
|
| ^^^^^^^^^ help: consider parenthesizing your expression `1 ^ (1 - 1)`
|
||||||
|
|
||||||
|
error: operator precedence can trip the unwary
|
||||||
|
--> $DIR/precedence.rs:13:5
|
||||||
|
|
|
||||||
|
13 | 3 | 2 - 1;
|
||||||
|
| ^^^^^^^^^ help: consider parenthesizing your expression `3 | (2 - 1)`
|
||||||
|
|
||||||
error: operator precedence can trip the unwary
|
error: operator precedence can trip the unwary
|
||||||
--> $DIR/precedence.rs:14:5
|
--> $DIR/precedence.rs:14:5
|
||||||
|
|
|
|
||||||
14 | 4 >> 1 + 1;
|
14 | 3 & 5 - 2;
|
||||||
| ^^^^^^^^^^ help: consider parenthesizing your expression `4 >> (1 + 1)`
|
|
||||||
|
|
||||||
error: operator precedence can trip the unwary
|
|
||||||
--> $DIR/precedence.rs:17:5
|
|
||||||
|
|
|
||||||
17 | 1 + 3 >> 2;
|
|
||||||
| ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 3) >> 2`
|
|
||||||
|
|
||||||
error: operator precedence can trip the unwary
|
|
||||||
--> $DIR/precedence.rs:20:5
|
|
||||||
|
|
|
||||||
20 | 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:26:5
|
|
||||||
|
|
|
||||||
26 | 3 & 5 - 2;
|
|
||||||
| ^^^^^^^^^ help: consider parenthesizing your expression `3 & (5 - 2)`
|
| ^^^^^^^^^ help: consider parenthesizing your expression `3 & (5 - 2)`
|
||||||
|
|
||||||
error: unary minus has lower precedence than method call
|
error: unary minus has lower precedence than method call
|
||||||
--> $DIR/precedence.rs:30:5
|
--> $DIR/precedence.rs:15:5
|
||||||
|
|
|
|
||||||
30 | -1i32.abs();
|
15 | -1i32.abs();
|
||||||
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1i32.abs())`
|
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1i32.abs())`
|
||||||
|
|
||||||
error: unary minus has lower precedence than method call
|
error: unary minus has lower precedence than method call
|
||||||
--> $DIR/precedence.rs:33:5
|
--> $DIR/precedence.rs:16:5
|
||||||
|
|
|
|
||||||
33 | -1f32.abs();
|
16 | -1f32.abs();
|
||||||
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1f32.abs())`
|
| ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1f32.abs())`
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error: aborting due to 9 previous errors
|
||||||
|
|
Loading…
Reference in a new issue