rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

Bad indentation of `if ... else` #438

Open Chris00 opened 2 years ago

Chris00 commented 2 years ago

Example:

fn main() {
    let x =
        if 1 == 2 { 1 }
    else { 3};
}

It should be

fn main() {
    let x =
        if 1 == 2 { 1 }
        else { 3};
}
Chris00 commented 2 years ago

As a variant of the above:

fn main() {
    let x = if test { then_clause }
    else { else_clause };
}

Another one (triggered it seems by the < of <=):

fn main() {
    let x = if 0. <= v { then_clause }
                  else { else_clause };
                  let y = 1;
                  f(y)
}