Sisu
E0079

_ used as a value

ErrorSafe fix

Built from the repository at commit a8614dc.

_ is no value. It is valid only after let and for, where it binds nothing. Reading it, as in print(_), or assigning to it, as in _ = make(), is an error.

Why

A name that is _ holds nothing, so there is nothing to read or to assign to. To evaluate an expression and drop its value, bind it with let _. When the statement is a plain _ = e, the fix writes let in front of it. For _ += e and the like there is no fix, because let _ += e is not a statement.

Broken

fn make() -> i64 {
    1
}

fn main() {
    _ = make()
}

What sisu says

error[E0079]: `_` is not a value
 --> E0079.sisu:6:5
  |
6 |     _ = make()
  |     ^
  |
help: bind it with `let _`
  |
6 |     let _ = make()
  |     +++

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0079

Fixed

fn make() -> i64 {
    1
}

fn main() {
    let _ = make()
}

Related

  • E0080: _ used as a name.