rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Spurious semicolon inside closure is not idempotent

Open Kyuuhachi opened this issue 11 months ago • 1 comments

Consider the following snippet.

fn foo() -> fn(i32) -> i32 {
    |a| {
        ;
        a
    }
}

Rustfmt starts by removing that spurious semicolon.

fn foo() -> fn(i32) -> i32 {
    |a| {
        a
    }
}

If run again, it notices that the closure fits on one line.

fn foo() -> fn(i32) -> i32 {
    |a| a
}

Kyuuhachi avatar Mar 14 '24 11:03 Kyuuhachi

@rustbot claim

rscprof avatar Mar 29 '24 06:03 rscprof