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

config: Introduce RunConfig for config related to a single run #795

Closed
wants to merge 3 commits into from

Conversation

kamalmarhubi
Copy link
Contributor

config: Introduce RunConfig for config related to a single run

This pull request introduces a RunConfig struct, and threads it
through all libraries, binaries, and tests. It carries configuration
related to a single run of rustfmt, as distinct from configuration
read in from the rustfmt.toml file. The verbose and skip-children
settings are moved to RunConfig.

Other examples of such per-run settings:

refs #434

Add an exported macro `impl_default_and_override` to `util`, allowing
that functionality to be reused without also implementing parsing and
documentation printing.
This commit introduces a `RunConfig` struct, and threads it through all
libraries, binaries, and tests. While initially empty, this will be a
place to store configuration related to a single run of `rustfmt`, as
distinct from configuration read in from the `rustfmt.toml` file.

Examples of such per-run settings include:
 - the `write_mode` override
 - the `--verbose` flag
 - the `--skip-children` flag
 - line ranges to restrict formatting to; see rust-lang#434

These will be added to `RunConfig` in later commits.

refs rust-lang#434
@kamalmarhubi
Copy link
Contributor Author

Thinking about this a bit more, it might not be the right abstraction. Using the same Config type and merging into a single config that gets threaded around seems better. Going to sleep on it.

@nrc
Copy link
Member

nrc commented Feb 1, 2016

I like the sound of the alternative you describe better - sounds like less complexity.

@kamalmarhubi
Copy link
Contributor Author

Yeah, I think so too. The realisation came up while trying to move write_mode into RunConfig. It was a lot more work than seemed reasonable!

I'll try and put together a PR with the alternative today so that I can actually start on #434!

@kamalmarhubi
Copy link
Contributor Author

Closing in favor of #801.

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.

2 participants