E0044Comparison of a value that is never
Error
Comparison of a value that is never None with None
ErrorOnly an optional can be None. Comparing a value of another type with None has a fixed answer, so Sisu reports it.
Why
A comparison that can only come out one way is a sign that the type is not what the writer thinks. Either the value should be optional, or the comparison should go.
Broken
fn main() {
let n = 5
print(n == None)
}
What sisu says
error[E0044]: `n` is not optional, so it is never `None` --> E0044.sisu:3:11 | 3 | print(n == None) | ^^^^^^^^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0044
Fixed
fn main() {
let n: i64? = 5
print(n == None)
}
Sisu