treefmt: add nightly rustfmt via fenix with formatting config#1630
treefmt: add nightly rustfmt via fenix with formatting config#1630amaanq wants to merge 1 commit intoNixOS:masterfrom
Conversation
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.
|
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. |
|
@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. |
|
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 |
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.