S0055: cannot infer error type of ok
Generated from rellum-diagnostics/src/db.rs.
Explanation
The ok(...) constructor supplies the success payload of a Result, but it does not name the error type. The surrounding annotation or expected type must establish Result[T, E] so the compiler can choose E.
Common causes
- returning ok(...) from an unannotated function
- using ok(...) in a graph or state binding without a Result annotation
- constructing ok(...) where no surrounding Result type is expected
Canonical fixes
- add a Result annotation that names the error type
Before:
value = ok(1)
After:
value: Result[Int, String] = ok(1)
- return ok(...) from a function with an explicit Result return type
Before:
parse() = ok(1)
After:
parse() : Result[Int, String] = ok(1)
Code example
value = ok(1)