Dylan DPC
b0c7e64de0
Rollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726
suggestion for unit enum variant when matched with a patern
resolve #84700
add suggestion for code like
```rust
enum FarmAnimal {
Worm,
Cow,
Bull,
Chicken { num_eggs: usize },
Dog (String),
}
fn what_does_the_animal_say(animal: &FarmAnimal) {
let noise = match animal {
FarmAnimal::Cow(_) => "moo".to_string(),
_ => todo!()
};
println!("{:?} says: {:?}", animal, noise);
}
```
```
error[E0532]: expected tuple struct or tuple variant, found unit variant `FarmAnimal::Cow`
--> $DIR/issue-84700.rs:15:9
|
LL | Cow,
| --- `FarmAnimal::Cow` defined here
...
LL | FarmAnimal::Cow(_) => "moo".to_string(),
| ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow`
```
2021-05-03 00:32:44 +02:00
..
2021-04-28 20:35:17 +00:00
2021-04-29 21:26:15 +02:00
2021-04-28 05:52:47 +00:00
2021-04-27 17:12:51 -07:00
2021-04-30 18:46:59 +02:00
2021-05-02 17:00:23 +02:00
2021-04-30 06:59:37 +00:00
2021-04-29 02:53:52 +00:00
2021-04-29 08:35:08 +08:00
2021-04-25 23:15:10 +02:00
2021-04-30 06:59:37 +00:00
2021-04-30 06:59:37 +00:00
2021-04-25 14:00:49 +00:00
2021-04-23 13:29:18 -04:00
2021-04-27 16:46:33 +00:00
2021-04-25 11:08:33 +02:00
2021-04-28 18:10:44 -04:00
2021-04-30 06:59:37 +00:00
2021-04-28 20:35:17 +00:00
2021-04-29 15:25:17 -07:00
2021-04-27 16:48:25 +00:00
2021-05-02 17:00:22 +02:00
2021-05-01 19:01:06 -04:00
2021-04-24 23:16:03 +00:00
2021-04-28 20:35:17 +00:00
2021-04-29 08:35:08 +08:00
2021-04-29 17:26:46 -04:00
2021-05-01 20:13:18 -04:00
2021-05-02 13:58:38 +02:00
2021-05-03 00:32:40 +02:00
2021-04-30 06:59:37 +00:00
2021-05-03 00:32:40 +02:00
2021-04-27 14:34:23 -04:00
2021-04-29 21:36:48 +02:00
2021-05-03 00:32:42 +02:00