Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to extend an existing config with missing defaults #6472

Open
axos88 opened this issue Feb 12, 2025 · 2 comments
Open

Add ability to extend an existing config with missing defaults #6472

axos88 opened this issue Feb 12, 2025 · 2 comments

Comments

@axos88
Copy link

axos88 commented Feb 12, 2025

Having an old configuration file, I would like the ability to add any new, missing configuration values after upgrading rustfmt - probably at the end -, to be reviewed and configure according to our style. I would expect this to be be a "maximal" configuration containing all supported configuration values.

Currently rustfmt print overwrites the file with the default config, and needs to be merged by hand - also I'm not entirely sure if the "default" configuration is exhaustive or not.

@ytmimi
Copy link
Contributor

ytmimi commented Feb 12, 2025

running rustfmt --print-config default is exhaustive, and even includes the default for nightly only options that you can't set on stable. I'm not sure what you mean about overwriting the default. The configs are just output to your terminal.

Could you not do something like this:

rustfmt --print-config default > rustfmt.toml.new
git diff --no-index rustfmt.toml rustfmt.toml.new

And then check which new defaults were added. It's very rare that default values change.

@axos88
Copy link
Author

axos88 commented Feb 15, 2025

Sure, but manually merging the current config and the default config is tedious, especially since - in my case - a few options have been renamed, or removed.

One approach would be to give rustfmt print out its active configuration in an exhaustive way (handling renames and defaulting missing values).

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

No branches or pull requests

2 participants