Sisu
E0024

Chained ==, != or is

Error

Built from the repository at commit a8614dc.

==, != and is do not chain: a second one after the first in the same expression is an error.

Why

a == b == c reads as "all equal" in some languages and as a comparison of a boolean in others. Sisu allows neither. Join separate comparisons with &&.

Broken

fn main() {
    let a = 1
    let b = 1
    let c = 1
    print(a == b == c)
}

What sisu says

error[E0024]: `==`, `!=` and `is` do not chain
 --> E0024.sisu:5:18
  |
5 |     print(a == b == c)
  |                  ^^
  |
  = help: join the comparisons with `&&`

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

Fixed

fn main() {
    let a = 1
    let b = 1
    let c = 1
    print(a == b && b == c)
}