-
Notifications
You must be signed in to change notification settings - Fork 911
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
Wrap/unwrap match arms #603
Conversation
@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/"), |
There was a problem hiding this comment.
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.
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 |
Added option and additional tests. |
Closes #390.