XO0305: `_` arm hides variants of an enum declared in this module
Warning. An unguarded _ or catch all binding arm on an enum declared in the same module hides the variants it covers, so adding a variant later compiles silently instead of failing at every match. List the variants (an or pattern such as B | C keeps it short). Enums from other modules, the prelude (Option, Result), and non enum values may use _, since their owners can add variants. A _ arm that hides at least 8 variants and more than half of the enum is a deliberate default and is not reported (decision 0080). See core 3.5.
Example
enum E { A, B, C }
fn f(e: E) -> Int {
match e {
A => 1
_ => 2
}
}Fix
enum E { A, B, C }
fn f(e: E) -> Int {
match e {
A => 1
B | C => 2
}
}Run xo explain XO0305 for this text in a terminal, or see
section 10.6 of the specification.