rust-clippy/tests/ui/collapsible_if.stderr
2017-04-10 15:36:07 +02:00

256 lines
4.8 KiB
Text

error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:8:5
|
8 | if x == "hello" {
| _____^ starting here...
9 | |
10 | |
11 | |
... |
14 | | }
15 | | }
| |_____^ ...ending here
|
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:17:5
|
17 | if x == "hello" || x == "world" {
| _____^ starting here...
18 | |
19 | |
20 | |
... |
23 | | }
24 | | }
| |_____^ ...ending here
|
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" {
| _____^ starting here...
27 | |
28 | |
29 | |
... |
32 | | }
33 | | }
| |_____^ ...ending here
|
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:35:5
|
35 | if x == "hello" || x == "world" {
| _____^ starting here...
36 | |
37 | |
38 | |
... |
41 | | }
42 | | }
| |_____^ ...ending here
|
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:44:5
|
44 | if x == "hello" && x == "world" {
| _____^ starting here...
45 | |
46 | |
47 | |
... |
50 | | }
51 | | }
| |_____^ ...ending here
|
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:53:5
|
53 | if 42 == 1337 {
| _____^ starting here...
54 | |
55 | |
56 | |
... |
59 | | }
60 | | }
| |_____^ ...ending here
|
help: try
| if 42 == 1337 && 'a' != 'A' {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:65:12
|
65 | } else {
| ____________^ starting here...
66 | |
67 | |
68 | |
... |
71 | | }
72 | | }
| |_____^ ...ending here
|
help: try
| } else if y == "world" {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:76:12
|
76 | } else {
| ____________^ starting here...
77 | |
78 | |
79 | |
... |
82 | | }
83 | | }
| |_____^ ...ending here
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:87:12
|
87 | } else {
| ____________^ starting here...
88 | |
89 | |
90 | |
... |
96 | | }
97 | | }
| |_____^ ...ending here
|
help: try
| } else if y == "world" {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:101:12
|
101 | } else {
| ____________^ starting here...
102 | |
103 | |
104 | |
... |
110 | | }
111 | | }
| |_____^ ...ending here
|
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:115:12
|
115 | } else {
| ____________^ starting here...
116 | |
117 | |
118 | |
... |
124 | | }
125 | | }
| |_____^ ...ending here
|
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:129:12
|
129 | } else {
| ____________^ starting here...
130 | |
131 | |
132 | |
... |
138 | | }
139 | | }
| |_____^ ...ending here
|
help: try
| } else if x == "hello" {
| println!("world")
| }
| else {
| println!("!")
| }
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:143:12
|
143 | } else {
| ____________^ starting here...
144 | |
145 | |
146 | |
... |
152 | | }
153 | | }
| |_____^ ...ending here
|
help: try
| } else if let Some(42) = Some(42) {
| println!("world")
| }
| else {
| println!("!")
| }
error: aborting due to 13 previous errors