Merge pull request #1488 from topecongiro/long-match-arm

Use block when arm exceeds max_width
This commit is contained in:
Nick Cameron 2017-05-02 13:49:02 +12:00 committed by GitHub
commit c68e5a8e37
3 changed files with 19 additions and 1 deletions

View file

@ -1356,7 +1356,9 @@ impl Rewrite for ast::Arm {
};
match rewrite {
Some(ref body_str) if !body_str.contains('\n') || !context.config.wrap_match_arms ||
Some(ref body_str) if (!body_str.contains('\n') &&
body_str.len() <= arm_shape.width) ||
!context.config.wrap_match_arms ||
is_block => {
let block_sep = match context.config.control_brace_style {
ControlBraceStyle::AlwaysNextLine if is_block => alt_block_sep.as_str(),

View file

@ -373,3 +373,10 @@ fn issue1456() {
},
})
}
fn issue1460() {
let _ = match foo {
REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT => "internal_spec_insert_internal_spec_insert_internal_spec_insert",
_ => "reorder_something",
};
}

View file

@ -389,3 +389,12 @@ fn issue1456() {
},
})
}
fn issue1460() {
let _ = match foo {
REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT => {
"internal_spec_insert_internal_spec_insert_internal_spec_insert"
}
_ => "reorder_something",
};
}