menu

no-single-binding-match

Prefer direct evaluation over a match with one irrefutable arm

A match with one unguarded binding arm accepts every value and performs no selection. Instead, you SHOULD bind the value directly in a do expression.

Reported

1function double(value: int32): int32 {2    return match (value) {3        matched => matched * 24    };5}

Accepted

1function double(value: int32): int32 {2    return do {3        const matched = value;4        matched * 25    };6}