Cursed if-statement

541 points ZZaaaccc

An interesting consequence of if statements being usable as expressions, and Rust not requiring brackets around the condition, is you can stack if indefinitely.

if if if a == b {
    b == c
} else {
    a == c
} {
    a == d
} else {
    c == d
} {
    println!("True!");
} else {
    println!("False!");
}

clippy and rustfmt don't catch this, and it's quite possibly the most cursed thing I've ever seen written in safe Rust.