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

Wrap/unwrap match arms #603

Merged
merged 4 commits into from
Nov 20, 2015
Merged

Wrap/unwrap match arms #603

merged 4 commits into from
Nov 20, 2015

Conversation

marcusklaas
Copy link
Contributor

Closes #390.

@marcusklaas
Copy link
Contributor Author

@nikomatsakis mentioned in one of the rustfmt-rust PRs that we should consider wrapping either all arms in blocks or none to improve consistency within a match. Looking at the current results, I think this makes sense. It's not implemented in this PR, but I think we should have an option for this at least.

@@ -249,8 +249,10 @@ fn handle_result(result: HashMap<String, String>,
fn get_target(file_name: &str, target: Option<&str>, write_mode: WriteMode) -> String {
let file_path = Path::new(file_name);
let (source_path_prefix, target_path_prefix) = match write_mode {
WriteMode::Coverage => (Path::new("tests/coverage-source/"),
"tests/coverage-target/"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make an exception to the multi-line rule for literals some how? E.g., a multi-line if or match looks better in a block, but I feel like here the original is better. Just a thought for later improvement.

@nrc
Copy link
Member

nrc commented Nov 15, 2015

Could we add an option for whether or not we strip/add blocks in match arms? Not sure if it is more important than closures, but it feels like it - maybe because match arms get re-written more often?

r+ with or without an option, but with the nits addressed

@marcusklaas
Copy link
Contributor Author

Added option and additional tests.

marcusklaas added a commit that referenced this pull request Nov 20, 2015
@marcusklaas marcusklaas merged commit bdc2e4f into rust-lang:master Nov 20, 2015
@marcusklaas marcusklaas deleted the multiline-math-armz branch November 20, 2015 20:58
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