Skip to content

rustfmt requires two runs to converge on contrived input #6437

Open
@jrose-signal

Description

@jrose-signal
fn test(input: Foo) {
    match input {
        Foo::Bar => {
            ;
            Baz {
                field: 0
            }
        }
    }
}

Given this admittedly contrived input, running rustfmt once removes the semicolon. Running it a second time removes the braces for the match body.

I don't know if rustfmt has a rule about being idempotent, but it certainly would surprise me to regularly encounter situations where I have to manually run it to a fixed point.

Tested in the playground, 1.8.0-stable (2024-11-26 90b35a6239).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions