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
base: master
from

Conversation

Projects
None yet
2 participants
@kamalmarhubi
Copy link
Contributor

kamalmarhubi commented Jan 31, 2016

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:

  • the write_mode override
  • line ranges to restrict formatting to; see #434

refs #434

kamalmarhubi added some commits Jan 30, 2016

config: Introduce RunConfig for config related to a single run
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 #434

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

refs #434
config: Extract macro to implement Default and override_value
Add an exported macro `impl_default_and_override` to `util`, allowing
that functionality to be reused without also implementing parsing and
documentation printing.
@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 1, 2016

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

This comment has been minimized.

Copy link
Member

nrc commented Feb 1, 2016

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

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 1, 2016

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

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 2, 2016

Closing in favor of #801.

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