Sisu
E0006

else on a line of its own

ErrorSafe fix

Built from the repository at commit a8614dc.

An else must stand on the same line as the } that closes the if before it.

Why

A line break after } ends the if statement, so an else at the start of the next line has nothing to belong to. Sisu has one layout, } else {, so a reader sees at once that the two blocks belong together.

Broken

fn main() {
    let n = 3
    if n > 2 {
        print(1)
    }
    else {
        print(0)
    }
}

What sisu says

error[E0006]: `else` must be on the same line as the closing `}`
 --> E0006.sisu:6:5
  |
6 |     else {
  |     ^^^^
  |
help: move `else` after the `}`
  |
5 |     } else {
  |      +

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

Fixed

fn main() {
    let n = 3
    if n > 2 {
        print(1)
    } else {
        print(0)
    }
}