E4139#
This expression has type that cannot be implicitly ignored. Use ignore(...) or
let _ = ... to explicitly ignore it.
Unit type can be implicitly ignored.
Erroneous example#
For example,
fn main {
1 + 1 // This expression has type Int, its value cannot be implicitly ignored.
}
The code here show a deeper problem of the logic of the code: discarding the result makes the computation useless.
Suggestion#
If you do want to discard the result, use ignore(..) or let _ = to
explicitly discard the value.
fn main {
ignore(1 + 1)
}