Account for match expr in single line

When encountering `match Some(42) { Some(x) => x, None => "" };`, output

```
error[E0308]: `match` arms have incompatible types
 --> f53.rs:2:52
  |
2 |     let _ = match Some(42) { Some(x) => x, None => "" };
  |             --------------              -          ^^ expected integer, found `&str`
  |             |                           |
  |             |                           this is found to be of type `{integer}`
  |             `match` arms have incompatible types
  ```
This commit is contained in:
Esteban Küber 2022-12-05 19:42:21 -08:00
parent 92c1937a90
commit 05e8ba126c
3 changed files with 17 additions and 2 deletions

View file

@ -0,0 +1,3 @@
fn main() {
let _ = match Some(42) { Some(x) => x, None => "" }; //~ ERROR E0308
}

View file

@ -0,0 +1,12 @@
error[E0308]: `match` arms have incompatible types
--> $DIR/single-line.rs:2:52
|
LL | let _ = match Some(42) { Some(x) => x, None => "" };
| -------------- - ^^ expected integer, found `&str`
| | |
| | this is found to be of type `{integer}`
| `match` arms have incompatible types
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.