Group imports together with imports_granularity results in non-idempotent formatting #6195
Labels
a-imports
`use` syntax
bug
Panic, non-idempotency, invalid code, etc.
only-with-option
requires a non-default option value to reproduce
When
group_imports = "StdExternalCrate"
is combined withimports_granularity = "Module"
,rustfmt
can format a file in a non-idempotent way, i.e. runningrustfmt
twice in a row results in a different formatting.Reduced from a case in the
stdlib
(rust-lang/rust#126394).Minimal repro:
First run (
rustfmt file.rs
):Second run (
rustfmt file.rs
):Removing the
group_imports
orimports_granularity
options removes the issue. The problem seems to be caused by the comment, without it it works fine.The text was updated successfully, but these errors were encountered: