# E0010

Warning name: `unused_pattern`

This pattern is unused. This usually happens in pattern matching, and this
pattern is completely covered by a prior pattern.

Pattern matching in MoonBit is executed sequentially, from the first branch to
the last. If a pattern is covered by a prior pattern, it will never be reached,
since all control flow will be directed to the first matching branch.

## Erroneous example

```{literalinclude} /sources/error_codes/0010_error/top.mbt
:language: moonbit
```

## Suggestion

This warning can usually be fixed by removing the patterns that are covered.

```{literalinclude} /sources/error_codes/0010_fixed/top.mbt
:language: moonbit
:start-after: eliminate pattern
:end-before: end eliminate pattern
```
