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: Use write_mode from config #812

Merged
merged 1 commit into from Feb 9, 2016

Conversation

Projects
None yet
2 participants
@kamalmarhubi
Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

This commit tidies up handling of write_mode by setting it in the
config at the start, and removing the write_mode parameter threaded
throughout the formatting process.

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:write-mode-from-config branch from 6e68d23 to 2159c8b Feb 5, 2016

@@ -112,6 +113,14 @@ fn match_cli_path_or_file(config_path: Option<PathBuf>,
fn update_config(config: &mut Config, matches: &Matches) {
config.verbose = matches.opt_present("verbose");
config.skip_children = matches.opt_present("skip-children");

let write_mode = matches.opt_str("write-mode").map(|ref s| {
WriteMode::from_str(s).expect(&format!("Invalid write-mode: {}", s))

This comment has been minimized.

@nrc

nrc Feb 8, 2016

Member

We shouldn't panic due to invalid user input. We should exit gracefully with the message.

This comment has been minimized.

@kamalmarhubi

kamalmarhubi Feb 8, 2016

Contributor

Done.

@nrc

This comment has been minimized.

Copy link
Member

nrc commented Feb 8, 2016

LGTM, just that one comment to address

@nrc

This comment has been minimized.

Copy link
Member

nrc commented Feb 9, 2016

I prefer the version you've currently implemented, thanks! However, you now have a test error.

Could you also squash the commits before I merge?

config: Use write_mode from config
This commit tidies up handling of `write_mode` by setting it in the
config at the start, and removing the `write_mode` parameter threaded
throughout the formatting process.

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:write-mode-from-config branch from 732e18b to 14dbac5 Feb 9, 2016

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 9, 2016

However, you now have a test error.

The formating tool that tests its own formatting... keeps biting! :-)

Could you also squash the commits before I merge?

Should be all done!

@nrc

This comment has been minimized.

Copy link
Member

nrc commented Feb 9, 2016

Awesome, thanks!

nrc added a commit that referenced this pull request Feb 9, 2016

Merge pull request #812 from kamalmarhubi/write-mode-from-config
config: Use write_mode from config

@nrc nrc merged commit 347cbb1 into rust-lang:master Feb 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment