Skip to content

Leading whitespace in a file isn't removed after formatting if code is indented even 1 character #6603

Open
@antonilol

Description

@antonilol

Code:

    use core::cmp::max;

(empty line, then 4 spaces and a use, github does not display this correctly for me)

after first run of rustfmt:

$ echo -e "\n    use core::cmp::max;" | rustfmt

use core::cmp::max;

(notice the blank line before the use)

after the second run:

$ echo -e "\n    use core::cmp::max;" | rustfmt | rustfmt
use core::cmp::max;

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-whitespacebugPanic, non-idempotency, invalid code, etc.p-low

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions