E0025: Pattern Enum Mismatch
The enum in your pattern doesn't match the type of the value being matched.
Example
enum Color {
Red,
Green,
}
enum Status {
Active,
Inactive,
}
fn check(c: Color) -> i64 {
match c {
Status::Active => { 1 }, // Error: pattern references enum `Status` but scrutinee has type `Color`
Status::Inactive => { 0 },
}
}
How to fix
Use patterns from the correct enum:
enum Color {
Red,
Green,
}
fn check(c: Color) -> i64 {
match c {
Color::Red => { 1 },
Color::Green => { 0 },
}
}