clean tests/ui/collapsible_if.rs

Cleaning the empty lines for clarity.
This commit is contained in:
Luis de Bethencourt 2017-05-11 11:00:31 +01:00
parent ed713d67d6
commit aa3d361bec
2 changed files with 103 additions and 158 deletions

View File

@ -6,54 +6,36 @@ fn main() {
let x = "hello";
let y = "world";
if x == "hello" {
if y == "world" {
println!("Hello world!");
}
}
if x == "hello" || x == "world" {
if y == "world" || y == "hello" {
println!("Hello world!");
}
}
if x == "hello" && x == "world" {
if y == "world" || y == "hello" {
println!("Hello world!");
}
}
if x == "hello" || x == "world" {
if y == "world" && y == "hello" {
println!("Hello world!");
}
}
if x == "hello" && x == "world" {
if y == "world" && y == "hello" {
println!("Hello world!");
}
}
if 42 == 1337 {
if 'a' != 'A' {
println!("world!")
}
@ -63,9 +45,6 @@ fn main() {
if x == "hello" {
print!("Hello ");
} else {
if y == "world" {
println!("world!")
}
@ -74,9 +53,6 @@ fn main() {
if x == "hello" {
print!("Hello ");
} else {
if let Some(42) = Some(42) {
println!("world!")
}
@ -85,9 +61,6 @@ fn main() {
if x == "hello" {
print!("Hello ");
} else {
if y == "world" {
println!("world")
}
@ -99,9 +72,6 @@ fn main() {
if x == "hello" {
print!("Hello ");
} else {
if let Some(42) = Some(42) {
println!("world")
}
@ -113,9 +83,6 @@ fn main() {
if let Some(42) = Some(42) {
print!("Hello ");
} else {
if let Some(42) = Some(42) {
println!("world")
}
@ -127,9 +94,6 @@ fn main() {
if let Some(42) = Some(42) {
print!("Hello ");
} else {
if x == "hello" {
println!("world")
}
@ -141,9 +105,6 @@ fn main() {
if let Some(42) = Some(42) {
print!("Hello ");
} else {
if let Some(42) = Some(42) {
println!("world")
}

View File

@ -2,12 +2,10 @@ error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:8:5
|
8 | / if x == "hello" {
9 | |
10 | |
11 | |
... |
14 | | }
15 | | }
9 | | if y == "world" {
10 | | println!("Hello world!");
11 | | }
12 | | }
| |_____^
|
note: lint level defined here
@ -21,15 +19,13 @@ help: try
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:17:5
--> $DIR/collapsible_if.rs:14:5
|
17 | / if x == "hello" || x == "world" {
18 | |
19 | |
20 | |
... |
23 | | }
24 | | }
14 | / if x == "hello" || x == "world" {
15 | | if y == "world" || y == "hello" {
16 | | println!("Hello world!");
17 | | }
18 | | }
| |_____^
|
help: try
@ -38,15 +34,13 @@ help: try
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:26:5
--> $DIR/collapsible_if.rs:20:5
|
26 | / if x == "hello" && x == "world" {
27 | |
28 | |
29 | |
... |
32 | | }
33 | | }
20 | / if x == "hello" && x == "world" {
21 | | if y == "world" || y == "hello" {
22 | | println!("Hello world!");
23 | | }
24 | | }
| |_____^
|
help: try
@ -55,15 +49,13 @@ help: try
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:35:5
--> $DIR/collapsible_if.rs:26:5
|
35 | / if x == "hello" || x == "world" {
36 | |
37 | |
38 | |
... |
41 | | }
42 | | }
26 | / if x == "hello" || x == "world" {
27 | | if y == "world" && y == "hello" {
28 | | println!("Hello world!");
29 | | }
30 | | }
| |_____^
|
help: try
@ -72,15 +64,13 @@ help: try
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:44:5
--> $DIR/collapsible_if.rs:32:5
|
44 | / if x == "hello" && x == "world" {
45 | |
46 | |
47 | |
... |
50 | | }
51 | | }
32 | / if x == "hello" && x == "world" {
33 | | if y == "world" && y == "hello" {
34 | | println!("Hello world!");
35 | | }
36 | | }
| |_____^
|
help: try
@ -89,15 +79,13 @@ help: try
| }
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:53:5
--> $DIR/collapsible_if.rs:38:5
|
53 | / if 42 == 1337 {
54 | |
55 | |
56 | |
... |
59 | | }
60 | | }
38 | / if 42 == 1337 {
39 | | if 'a' != 'A' {
40 | | println!("world!")
41 | | }
42 | | }
| |_____^
|
help: try
@ -106,16 +94,14 @@ help: try
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:65:12
--> $DIR/collapsible_if.rs:47:12
|
65 | } else {
47 | } else {
| ____________^
66 | |
67 | |
68 | |
... |
71 | | }
72 | | }
48 | | if y == "world" {
49 | | println!("world!")
50 | | }
51 | | }
| |_____^
|
help: try
@ -124,16 +110,14 @@ help: try
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:76:12
--> $DIR/collapsible_if.rs:55:12
|
76 | } else {
55 | } else {
| ____________^
77 | |
78 | |
79 | |
... |
82 | | }
83 | | }
56 | | if let Some(42) = Some(42) {
57 | | println!("world!")
58 | | }
59 | | }
| |_____^
|
help: try
@ -142,16 +126,16 @@ help: try
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:87:12
--> $DIR/collapsible_if.rs:63:12
|
87 | } else {
63 | } else {
| ____________^
88 | |
89 | |
90 | |
64 | | if y == "world" {
65 | | println!("world")
66 | | }
... |
96 | | }
97 | | }
69 | | }
70 | | }
| |_____^
|
help: try
@ -163,58 +147,58 @@ help: try
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:101:12
|
101 | } else {
| ____________^
102 | |
103 | |
104 | |
... |
110 | | }
111 | | }
| |_____^
|
--> $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!("!")
| }
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:115:12
|
115 | } else {
| ____________^
116 | |
117 | |
118 | |
... |
124 | | }
125 | | }
| |_____^
|
--> $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!("!")
| }
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:129:12
--> $DIR/collapsible_if.rs:96:12
|
129 | } else {
96 | } else {
| ____________^
130 | |
131 | |
132 | |
97 | | if x == "hello" {
98 | | println!("world")
99 | | }
... |
138 | | }
139 | | }
102 | | }
103 | | }
| |_____^
|
help: try
@ -226,16 +210,16 @@ help: try
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:143:12
--> $DIR/collapsible_if.rs:107:12
|
143 | } else {
107 | } else {
| ____________^
144 | |
145 | |
146 | |
108 | | if let Some(42) = Some(42) {
109 | | println!("world")
110 | | }
... |
152 | | }
153 | | }
113 | | }
114 | | }
| |_____^
|
help: try