rust/tests/ui/collapsible_if.stderr

261 lines
5.4 KiB
Plaintext
Raw Normal View History

error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:15:5
|
2018-12-27 16:57:55 +01:00
LL | / if x == "hello" {
LL | | if y == "world" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if x == "hello" && y == "world" {
LL | println!("Hello world!");
LL | }
2017-07-10 15:29:29 +02:00
|
error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:21:5
|
2018-12-27 16:57:55 +01:00
LL | / if x == "hello" || x == "world" {
LL | | if y == "world" || y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
LL | println!("Hello world!");
LL | }
2017-07-10 15:29:29 +02:00
|
error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:27:5
|
2018-12-27 16:57:55 +01:00
LL | / if x == "hello" && x == "world" {
LL | | if y == "world" || y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
LL | println!("Hello world!");
LL | }
2017-07-10 15:29:29 +02:00
|
error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:33:5
|
2018-12-27 16:57:55 +01:00
LL | / if x == "hello" || x == "world" {
LL | | if y == "world" && y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
LL | println!("Hello world!");
LL | }
2017-07-10 15:29:29 +02:00
|
error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:39:5
|
2018-12-27 16:57:55 +01:00
LL | / if x == "hello" && x == "world" {
LL | | if y == "world" && y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if x == "hello" && x == "world" && y == "world" && y == "hello" {
LL | println!("Hello world!");
LL | }
2017-07-10 15:29:29 +02:00
|
error: this if statement can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:45:5
|
2018-12-27 16:57:55 +01:00
LL | / if 42 == 1337 {
LL | | if 'a' != 'A' {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | if 42 == 1337 && 'a' != 'A' {
LL | println!("world!")
LL | }
2017-07-10 15:29:29 +02:00
|
error: this `else { if .. }` block can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:54:12
|
2018-12-27 16:57:55 +01:00
LL | } else {
| ____________^
2018-12-27 16:57:55 +01:00
LL | | if y == "world" {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | } else if y == "world" {
LL | println!("world!")
LL | }
2017-07-10 15:29:29 +02:00
|
error: this `else { if .. }` block can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:62:12
|
2018-12-27 16:57:55 +01:00
LL | } else {
| ____________^
2018-12-27 16:57:55 +01:00
LL | | if let Some(42) = Some(42) {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | } else if let Some(42) = Some(42) {
LL | println!("world!")
LL | }
2017-07-10 15:29:29 +02:00
|
error: this `else { if .. }` block can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:70:12
|
2018-12-27 16:57:55 +01:00
LL | } else {
| ____________^
2018-12-27 16:57:55 +01:00
LL | | if y == "world" {
LL | | println!("world")
LL | | }
... |
2018-12-27 16:57:55 +01:00
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | } else if y == "world" {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
2017-07-10 15:29:29 +02:00
|
error: this `else { if .. }` block can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:81:12
|
2018-12-27 16:57:55 +01:00
LL | } else {
| ____________^
2018-12-27 16:57:55 +01:00
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
... |
2018-12-27 16:57:55 +01:00
LL | | }
LL | | }
| |_____^
help: try
2017-07-10 15:29:29 +02:00
|
2018-12-27 16:57:55 +01:00
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
2017-07-10 15:29:29 +02:00
|
error: this `else { if .. }` block can be collapsed
2018-12-10 06:27:19 +01:00
--> $DIR/collapsible_if.rs:92:12
|
2018-12-27 16:57:55 +01:00
LL | } else {
2018-12-10 06:27:19 +01:00
| ____________^
2018-12-27 16:57:55 +01:00
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
2018-12-10 06:27:19 +01:00
... |
2018-12-27 16:57:55 +01:00
LL | | }
LL | | }
2018-12-10 06:27:19 +01:00
| |_____^
help: try
2018-12-10 06:27:19 +01:00
|
2018-12-27 16:57:55 +01:00
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
2018-12-10 06:27:19 +01:00
|
error: this `else { if .. }` block can be collapsed
2018-12-27 16:57:55 +01:00
--> $DIR/collapsible_if.rs:103:12
|
LL | } else {
| ____________^
LL | | if x == "hello" {
LL | | println!("world")
LL | | }
... |
LL | | }
LL | | }
| |_____^
help: try
2018-12-27 16:57:55 +01:00
|
LL | } else if x == "hello" {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this `else { if .. }` block can be collapsed
2018-12-27 16:57:55 +01:00
--> $DIR/collapsible_if.rs:114:12
|
LL | } else {
| ____________^
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
... |
LL | | }
LL | | }
| |_____^
help: try
2018-12-27 16:57:55 +01:00
|
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
2018-10-16 22:20:27 +02:00
error: this if statement can be collapsed
2018-12-27 16:57:55 +01:00
--> $DIR/collapsible_if.rs:173:5
|
LL | / if x == "hello" {
LL | | if y == "world" { // Collapsible
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
2018-10-16 22:20:27 +02:00
help: try
2018-12-27 16:57:55 +01:00
|
LL | if x == "hello" && y == "world" { // Collapsible
LL | println!("Hello world!");
LL | }
|
2018-10-16 22:20:27 +02:00
error: aborting due to 14 previous errors
2018-01-16 17:06:27 +01:00