Xo is experimental. The source code is not public yet; it will be soon. Read the release notes
Menu · XO0206

Docs

XO0206: `let _ =` discards a Result; use `.ignore_err("reason")`

error · reported by the checker

let _ = expr on a Result silently drops its error. Xo requires a reason instead: expr.ignore_err("why this failure does not matter") yields T? and records the reason, so every discarded error is searchable and reviewable (xo vet lists them, XO0208). The diagnostic carries a fix that inserts .ignore_err("TODO: reason"). Use r.ok() when failure simply means no value. See core 2.6.

Example

fn f(fs: Fs) uses fs.write {
  let _ = fs.remove("tmp")
}

Fix

fn f(fs: Fs) uses fs.write {
  let _ = fs.remove("tmp").ignore_err("best effort temp file cleanup")
}

Run xo explain XO0206 for this text in a terminal, or see section 10.6 of the specification.