# no-useless-switch-case

Disallow empty switch cases adjacent to the default case

An empty case adjacent to `default` reaches the same statements already selected for every unmatched value.
Instead, you SHOULD remove the redundant case selector.

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

## Reported

```ds title="main.ds"
function classify(value: int32): void {
    switch (value) {
        case 0:
        default:
            value;
    }
}
```

## Accepted

```ds title="main.ds"
function classify(value: int32): void {
    switch (value) {
        default:
            value;
    }
}
```

## Prior art

- [eslint-plugin-unicorn · no-useless-switch-case](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md)

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