rust-clippy/tests/ui/collapsible_if.stderr

235 lines
5 KiB
Text
Raw Normal View History

error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:8:5
|
8 | / if x == "hello" {
9 | | if y == "world" {
10 | | println!("Hello world!");
11 | | }
12 | | }
| |_____^
|
note: lint level defined here
--> $DIR/collapsible_if.rs:4:8
|
4 | #[deny(collapsible_if)]
| ^^^^^^^^^^^^^^
help: try
| if x == "hello" && y == "world" {
| println!("Hello world!");
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:14:5
|
14 | / if x == "hello" || x == "world" {
15 | | if y == "world" || y == "hello" {
16 | | println!("Hello world!");
17 | | }
18 | | }
| |_____^
|
help: try
| if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
| println!("Hello world!");
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:20:5
|
20 | / if x == "hello" && x == "world" {
21 | | if y == "world" || y == "hello" {
22 | | println!("Hello world!");
23 | | }
24 | | }
| |_____^
|
help: try
| if x == "hello" && x == "world" && (y == "world" || y == "hello") {
| println!("Hello world!");
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:26:5
|
26 | / if x == "hello" || x == "world" {
27 | | if y == "world" && y == "hello" {
28 | | println!("Hello world!");
29 | | }
30 | | }
| |_____^
|
help: try
| if (x == "hello" || x == "world") && y == "world" && y == "hello" {
| println!("Hello world!");
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:32:5
|
32 | / if x == "hello" && x == "world" {
33 | | if y == "world" && y == "hello" {
34 | | println!("Hello world!");
35 | | }
36 | | }
| |_____^
|
help: try
| if x == "hello" && x == "world" && y == "world" && y == "hello" {
| println!("Hello world!");
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:38:5
|
38 | / if 42 == 1337 {
39 | | if 'a' != 'A' {
40 | | println!("world!")
41 | | }
42 | | }
| |_____^
|
help: try
| if 42 == 1337 && 'a' != 'A' {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:47:12
|
47 | } else {
| ____________^
48 | | if y == "world" {
49 | | println!("world!")
50 | | }
51 | | }
| |_____^
|
help: try
| } else if y == "world" {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:55:12
|
55 | } else {
| ____________^
56 | | if let Some(42) = Some(42) {
57 | | println!("world!")
58 | | }
59 | | }
| |_____^
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:63:12
|
63 | } else {
| ____________^
64 | | if y == "world" {
65 | | println!("world")
66 | | }
... |
69 | | }
70 | | }
| |_____^
|
help: try
| } else if y == "world" {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:74:12
|
74 | } else {
| ____________^
75 | | if let Some(42) = Some(42) {
76 | | println!("world")
77 | | }
... |
80 | | }
81 | | }
| |_____^
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:85:12
|
85 | } else {
| ____________^
86 | | if let Some(42) = Some(42) {
87 | | println!("world")
88 | | }
... |
91 | | }
92 | | }
| |_____^
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:96:12
|
96 | } else {
| ____________^
97 | | if x == "hello" {
98 | | println!("world")
99 | | }
... |
102 | | }
103 | | }
| |_____^
|
help: try
| } else if x == "hello" {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:107:12
|
107 | } else {
| ____________^
108 | | if let Some(42) = Some(42) {
109 | | println!("world")
110 | | }
... |
113 | | }
114 | | }
| |_____^
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: aborting due to 13 previous errors