XO0201: Result value is never used
Handling errors is mandatory. A Result value that is not propagated with ?, matched, passed, returned, or stored is an error, and so is a Result bound to a name that is never used, whatever the name (including _x). This covers expression statements, defer, loop bodies, if without else, and the tail of a unit function or closure. The diagnostic offers ? as a fix. To discard on purpose, write .ignore_err("reason"). See core 2.6.
Example
enum E { A }
fn g() -> Int ! E { 1 }
fn f() {
g()
}Fix
enum E { A }
fn g() -> Int ! E { 1 }
fn f() ! E {
g()?
}Run xo explain XO0201 for this text in a terminal, or see
section 10.6 of the specification.