When I define a enum like this:
enum MyEnum {
one,
two,
three,
}
and match like this:
let n = MyEnum::two;
match n {
one => println!("one"),
two => println!("one"),
three => println!("three"),
}
it will always print one
. The correct way to match would be like this:
let n = MyEnum::two;
match n {
MyEnum::one => println!("one"),
MyEnum::two => println!("one"),
MyEnum::three => println!("three"),
}
Why the compiler does not show an error if I'm clearly matching my enum incorrectly?