Skip to content

Guard the rustfmt config that rustfmt reads, and default to field init shorthand - #8

Merged
jph00 merged 1 commit into
mainfrom
pr/guard-the-rustfmt-config-that-rustfmt-reads-and
Oct 15, 2026
Merged

jph00 merged 1 commit into
mainfrom
pr/guard-the-rustfmt-config-that-rustfmt-reads-and

Conversation

@jph00

@jph00 jph00 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

cargo fastfmt now puts its disable_all_formatting guard in the rustfmt.toml that rustfmt reads for each package: the nearest one from the package directory up to the repository root. It creates a new file in the package directory only when there is none. Previously it created a guard-only rustfmt.toml beside every sub-package's Cargo.toml, even when the root guard already covered it, and those files hid root settings such as max_width.

fastfmt also runs rustfmt with use_field_init_shorthand = true, which writes Foo { x: x } as Foo { x }. Like use_small_heuristics, it overrides the project's rustfmt.toml. Projects no longer need to set it themselves.

See "Install and use" in the README.

@jph00 jph00 added the enhancement New feature or request label Oct 15, 2026
@jph00
jph00 merged commit 0f5756c into main Oct 15, 2026
@jph00
jph00 deleted the pr/guard-the-rustfmt-config-that-rustfmt-reads-and branch October 15, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant