Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Nested empty use tree formatting is non-idempotent

Open Beginner friendly
#7,173 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Start by reading rustfmt's handling of nested use trees and the regression tests for import formatting; the issue does not name a specific source file or test. Reproduce with use std::sync::{Arc, atomic::{}}; using the shown stable formatting options. Done means one formatting pass produces use std::sync::Arc; with no extra whitespace, and formatting again leaves it unchanged.

Written by the indexing model from the issue text.

Description

A-imports C-bug E-hard I-non-idempotency X-impacts-stable-default-format

Summary

Not quite the same as https://github.com/rust-lang/rustfmt/issues/7140 since that issue is moreso about the interactions with unstable option. Extracted from the comment https://github.com/rust-lang/rustfmt/issues/7140#issuecomment-6098925992.

I tried to format this code:

use std::sync::{Arc, atomic::{}};
Expected behavior

I expected to see this happen: converges to a stable default format in a single pass (idempotent)

use std::sync::Arc;
Actual behavior

Instead, this happened: non-idempontent. Converges after 2 passes:

Pass 1
-use std::sync::{Arc, atomic::{}};
+use std::sync::{ Arc};

(Notice also the extra whitespace)

Pass 2
-use std::sync::{ Arc};
+use std::sync::Arc;

Configuration

Stable default format

rustfmt cli options used (if applicable):

rustfmt +stable foo.rs --config-path=/dev/null --style-edition=2024 --edition=2024

rustfmt configuration file (e.g. rustfmt.toml, if applicable): N/A

Reproduction Steps

See formatting passes above.

Meta

rustfmt --version:

rustfmt 1.10.0-stable (b940084d7e 2026-09-28)

Still broken on nightly.

Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/rustfmt

All issues in rust-lang/rustfmt

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.