# prefer-equality-over-pattern

Prefer equality over matching one complete scalar constant

A two-arm match that maps one scalar constant and a wildcard to opposite booleans only performs an equality test.
Instead, you SHOULD compare the scrutinee with the constant directly.

- Category: style
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
function isZero(value: int32): boolean {
    return match (value) {
        0 => true
        _ => false
    };
}
```

## Accepted

```ds title="main.ds"
function isZero(value: int32): boolean {
    return value === 0;
}
```

[language/linter/src/rules/style/prefer_equality_over_pattern.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/prefer_equality_over_pattern.rs#L8)
