Skip to content

Non-idempotent with empty line at beginning of file and wrong identation #6700

@ojeda

Description

@ojeda

With defaults, given an empty line plus a wrongly indented item on the next line, e.g. (using non-Rust formatting to avoid the Markdown renderer removing the first empty line):


    use a;

The first pass gives:


use a;

The second pass gives:

use a;

Reproduces with:

rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
rustfmt 1.8.0-nightly (be0ade2b60 2025-10-11)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-non-idempotencyIssue: non-idempotency (different formatting outcomes even though unchanged by user)I-poor-formattingIssue: poor formattingI-poor-indentationIssue: poor indentationS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions