S0022: some pattern requires Option
Generated from rellum-diagnostics/src/db.rs.
Explanation
The some(x) pattern extracts the payload from an Option value. It cannot match Result, Bool, enum, record, or scalar values because those types do not have Option's some/none shape.
Common causes
- using some(x) while matching a Result
- matching a plain value as if it were optional
- forgetting that a request handler has already converted an Option
Canonical fixes
- match an Option value with some and none arms
Before:
match value
some(x) => x
After:
match maybe
some(x) => x
none => fallback
- use ok/err when matching Result
Before:
match result
some(x) => x
After:
match result
ok(x) => x
err(_) => fallback
Code example
match value
some(x) => x