rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Ignoring empty statements in closures.

Open rscprof opened this issue 1 year ago • 1 comments

Solve #6116

rscprof avatar Mar 29 '24 07:03 rscprof

@rscprof Thanks again for your help on this. I've taken another look at this PR and there's another test case that I'd like to see if we can resolve before merging.

Given the following input:

fn foo() -> fn(i32) -> i32 {
    |x| {
        /*comment before empty statement */;/*comment between statements */;
        x
    }
}

it formats as

fn foo() -> fn(i32) -> i32 {
    |x| {
        /*comment before empty statement */        /*comment between statements */
        x
    }
}

running rustfmt again formats as

fn foo() -> fn(i32) -> i32 {
    |x| {
        /*comment before empty statement */
 /*comment between statements */
        x
    }
}

and running rustfmt once again stabilizes as:

fn foo() -> fn(i32) -> i32 {
    |x| {
        /*comment before empty statement */
        /*comment between statements */
        x
    }
}

ytmimi avatar Jan 23 '25 03:01 ytmimi