S0146: tuple pattern does not match scrutinee
Generated from rellum-diagnostics/src/db.rs.
Explanation
Tuple patterns can only destructure tuple values with the same number of fields. Each element pattern is checked against the corresponding tuple field type.
Common causes
- using a tuple pattern against a non-tuple value
- using too many or too few elements in a tuple pattern
- using
()as a pattern for a non-Unit value
Canonical fixes
- match the tuple arity exactly
Before:
match pair { (a, b, c) => a }
After:
match pair { (a, b) => a }
- use
_when the whole value should be ignored
Before:
match value { () => 0 }
After:
match value { _ => 0 }
Code example
match pair { (a, b, c) => a }