-
Notifications
You must be signed in to change notification settings - Fork 924
config: Introduce a mergeable config #801
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
Conversation
8894c3d
to
c673723
Compare
This commit replaces `ParsedConfig` with a `PartialConfig` that can be merged into a `Config` or another `PartialConfig`. This provides a unified place for configuration that is passed through rustfmt, and a mechanism for overriding settings from other sources. Expected uses: - overriding config file options from command line options - adding options that do not make sense in the config file, such as line ranges to restrict formatting to; see rust-lang#434 refs rust-lang#434
c673723
to
9e98191
Compare
This changes the handling of `write_mode` to use `PartialConfig` and `Config::merge()` for overriding, and to no longer thread it through the formatting code as a separate parameter.
What is the advantage of using a |
Part of the motivation was to tidy up how On reflection I don't feel too strongly about this change, so it's up to you. The |
Anyway, feel free to look over the changes moving |
(I think I was refactoring as a way to understand code here.) |
So, having the write mode be part of the config sounds like a good change. However, I don't see that using the builder pattern for the config is a pre-req for it. Maybe I'm missing something, but couldn't you just set it to some default and then reset it later in the right places? |
Yeah, the config stuff isn't necessary. I'll send another PR tomorrow that gets the write_mode read solely from the config. |
#812 replaces this. |
This pull request introduces a mergeable config abstraction, and uses it for the
verbose
andskip_children
configuration options.