261 lines
5.4 KiB
Plaintext
261 lines
5.4 KiB
Plaintext
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:15:5
|
|
|
|
|
15 | / if x == "hello" {
|
|
16 | | if y == "world" {
|
|
17 | | println!("Hello world!");
|
|
18 | | }
|
|
19 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
|
|
help: try
|
|
|
|
|
15 | if x == "hello" && y == "world" {
|
|
16 | println!("Hello world!");
|
|
17 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:21:5
|
|
|
|
|
21 | / if x == "hello" || x == "world" {
|
|
22 | | if y == "world" || y == "hello" {
|
|
23 | | println!("Hello world!");
|
|
24 | | }
|
|
25 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
21 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
|
22 | println!("Hello world!");
|
|
23 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:27:5
|
|
|
|
|
27 | / if x == "hello" && x == "world" {
|
|
28 | | if y == "world" || y == "hello" {
|
|
29 | | println!("Hello world!");
|
|
30 | | }
|
|
31 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
27 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
|
28 | println!("Hello world!");
|
|
29 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:33:5
|
|
|
|
|
33 | / if x == "hello" || x == "world" {
|
|
34 | | if y == "world" && y == "hello" {
|
|
35 | | println!("Hello world!");
|
|
36 | | }
|
|
37 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
33 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
|
34 | println!("Hello world!");
|
|
35 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:39:5
|
|
|
|
|
39 | / if x == "hello" && x == "world" {
|
|
40 | | if y == "world" && y == "hello" {
|
|
41 | | println!("Hello world!");
|
|
42 | | }
|
|
43 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
39 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
|
40 | println!("Hello world!");
|
|
41 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:45:5
|
|
|
|
|
45 | / if 42 == 1337 {
|
|
46 | | if 'a' != 'A' {
|
|
47 | | println!("world!")
|
|
48 | | }
|
|
49 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
45 | if 42 == 1337 && 'a' != 'A' {
|
|
46 | println!("world!")
|
|
47 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:54:12
|
|
|
|
|
54 | } else {
|
|
| ____________^
|
|
55 | | if y == "world" {
|
|
56 | | println!("world!")
|
|
57 | | }
|
|
58 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
54 | } else if y == "world" {
|
|
55 | println!("world!")
|
|
56 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:62:12
|
|
|
|
|
62 | } else {
|
|
| ____________^
|
|
63 | | if let Some(42) = Some(42) {
|
|
64 | | println!("world!")
|
|
65 | | }
|
|
66 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
62 | } else if let Some(42) = Some(42) {
|
|
63 | println!("world!")
|
|
64 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:70:12
|
|
|
|
|
70 | } else {
|
|
| ____________^
|
|
71 | | if y == "world" {
|
|
72 | | println!("world")
|
|
73 | | }
|
|
... |
|
|
76 | | }
|
|
77 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
70 | } else if y == "world" {
|
|
71 | println!("world")
|
|
72 | }
|
|
73 | else {
|
|
74 | println!("!")
|
|
75 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:81:12
|
|
|
|
|
81 | } else {
|
|
| ____________^
|
|
82 | | if let Some(42) = Some(42) {
|
|
83 | | println!("world")
|
|
84 | | }
|
|
... |
|
|
87 | | }
|
|
88 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
81 | } else if let Some(42) = Some(42) {
|
|
82 | println!("world")
|
|
83 | }
|
|
84 | else {
|
|
85 | println!("!")
|
|
86 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:92:12
|
|
|
|
|
92 | } else {
|
|
| ____________^
|
|
93 | | if let Some(42) = Some(42) {
|
|
94 | | println!("world")
|
|
95 | | }
|
|
... |
|
|
98 | | }
|
|
99 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
92 | } else if let Some(42) = Some(42) {
|
|
93 | println!("world")
|
|
94 | }
|
|
95 | else {
|
|
96 | println!("!")
|
|
97 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:103:12
|
|
|
|
|
103 | } else {
|
|
| ____________^
|
|
104 | | if x == "hello" {
|
|
105 | | println!("world")
|
|
106 | | }
|
|
... |
|
|
109 | | }
|
|
110 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
103 | } else if x == "hello" {
|
|
104 | println!("world")
|
|
105 | }
|
|
106 | else {
|
|
107 | println!("!")
|
|
108 | }
|
|
|
|
|
|
|
error: this `else { if .. }` block can be collapsed
|
|
--> $DIR/collapsible_if.rs:114:12
|
|
|
|
|
114 | } else {
|
|
| ____________^
|
|
115 | | if let Some(42) = Some(42) {
|
|
116 | | println!("world")
|
|
117 | | }
|
|
... |
|
|
120 | | }
|
|
121 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
114 | } else if let Some(42) = Some(42) {
|
|
115 | println!("world")
|
|
116 | }
|
|
117 | else {
|
|
118 | println!("!")
|
|
119 | }
|
|
|
|
|
|
|
error: this if statement can be collapsed
|
|
--> $DIR/collapsible_if.rs:173:5
|
|
|
|
|
173 | / if x == "hello" {
|
|
174 | | if y == "world" { // Collapsible
|
|
175 | | println!("Hello world!");
|
|
176 | | }
|
|
177 | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
173 | if x == "hello" && y == "world" { // Collapsible
|
|
174 | println!("Hello world!");
|
|
175 | }
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
|
|