Isn't the example below also refutable without the need of second enum variant? It looks like it's still a struct pattern
fn main() {
let x = Test::B {
field: 0
};
match x {
Test::B { field: 100 } => println!("first arm"),
_ => println!("second arm"),
}
}
enum Test {
B {
field: u32
}
}
EDIT:
Nevermind, I forgot about this:
A struct pattern is refutable if the PathInExpression resolves to a constructor of an enum with more than one variant, or one of its subpatterns is refutable.
Oh, I think I get it now!
There's a need for this:
Test::B { field } => {},
because without the exact syntax we wouldn't deal with struct pattern, but rather a path pattern, right?
Also, if there was just one variant, it wouldn't be refutable (because there's no way one variant won't match)