Skip to content

treefmt: add nightly rustfmt via fenix with formatting config#1630

Open
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:format
Open

treefmt: add nightly rustfmt via fenix with formatting config#1630
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:format

Conversation

@amaanq
Copy link
Copy Markdown
Member

@amaanq amaanq commented Mar 31, 2026

Problem

Rustfmt OOTB doesn't format a lot of stuff that'd be nice to have formatted. As an example, having comments automatically wrap would be nice.

Solution

This commit adds a rustfmt formatting config with some nightly options enabled that greatly improve the formatter. Some of the highlights include wrapping comments & strings, organizing imports, and formatting imports to have 1 import per line (which really helps with diffs). Due to all these formatting goodies, the diff is quite massive but nothing functionally changed.

This commit adds a rustfmt formatting config with some nightly options enabled that greatly improve the formatter. Some of the highlights include wrapping comments & strings, organizing imports, and formatting imports to have 1 import per line (which really helps with diffs). Due to all these formatting goodies, the diff is quite massive but nothing functionally changed.
@dasJ
Copy link
Copy Markdown
Member

dasJ commented Mar 31, 2026

Was a human involved in creating this PR? And is there an actual reason to not use the de-facto standard formatting? I'm strongly against this.

@Ericson2314
Copy link
Copy Markdown
Member

@amaanq told me he wanted to look into this yesterday, based on the settings he did in a different project (tree sitter), so yes a human was involved. I think after weeks of C++, it's been a bit of an "aesthetic drought", so having the prettiest Rust code to soothe his soul is the idea here. Very human.

Formatting settings tend to be mostly opinions, so "actual reasons" are a bit in the eye of the beholder. But "helping with diffs" is generally something I would care about.

I'm not going to die on the hill of formatter settings, but please be nice, @dasJ.

@Conni2461
Copy link
Copy Markdown
Member

i like that rust has a builtin formatter and i dont have to discuss which is the "correct" formatting, so i'd prefer if we not pull in the unstable rustfmt (we build with a stable rustc) with a bunch of custom config and just use the default config that rustfmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants