# no-duplicate-match-arms

Disallow match arms with identical bodies

Identical match arm bodies often indicate an editing mistake and repeat one result.
Instead, you SHOULD correct an unintended body or combine the patterns when their guards match.

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

## Reported

```ds title="main.ds"
function describe(value: int32): string {
    return match (value) {
        0 => "small"
        1 => "small"
        _ => "large"
    };
}
```

## Accepted

```ds title="main.ds"
function describe(value: int32): string {
    return match (value) {
        0 | 1 => "small"
        _ => "large"
    };
}
```

## Prior art

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

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