# wildcard-enum-match-arm

Disallow wildcard arms when matching nominal enums

A wildcard arm accepts every future variant added to an enum without requiring the match to be revisited.
Instead, you SHOULD name every expected variant so exhaustiveness checking exposes additions.

- Category: suspicious
- Level: warning
- Fix: none
- Scope: module

## Reported

```ds title="main.ds"
enum Mode {
    Read = 1,
    Write = 2,
}

function describe(mode: Mode): string {
    return match (mode) {
        Mode.Read => "read"
        _ => "other"
    };
}
```

## Accepted

```ds title="main.ds"
enum Mode {
    Read = 1,
    Write = 2,
}

function describe(mode: Mode): string {
    return match (mode) {
        Mode.Read => "read"
        Mode.Write => "write"
    };
}
```

## Prior art

- [Clippy · wildcard_enum_match_arm](https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm)

[language/linter/src/rules/suspicious/wildcard_enum_match_arm.rs:6](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/suspicious/wildcard_enum_match_arm.rs#L6)
