]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-84700.rs
Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errors
[rust.git] / tests / ui / suggestions / issue-84700.rs
1 // test for suggestion on fieldless enum variant
2
3 #[derive(PartialEq, Debug)]
4 enum FarmAnimal {
5     Worm,
6     Cow,
7     Bull,
8     Chicken { num_eggs: usize },
9     Dog (String),
10 }
11
12 fn what_does_the_animal_say(animal: &FarmAnimal) {
13
14     let noise = match animal {
15         FarmAnimal::Cow(_) => "moo".to_string(),
16         //~^ ERROR expected tuple struct or tuple variant, found unit variant `FarmAnimal::Cow`
17         FarmAnimal::Chicken(_) => "cluck, cluck!".to_string(),
18         //~^ ERROR expected tuple struct or tuple variant, found struct variant `FarmAnimal::Chicken`
19         FarmAnimal::Dog{..} => "woof!".to_string(),
20         _ => todo!()
21     };
22
23     println!("{:?} says: {:?}", animal, noise);
24 }
25
26 fn main() {}