fix Unparsable code when formmating (#3883)

This commit is contained in:
rChaser53 2019-10-24 22:16:56 +09:00 committed by Seiichi Uchida
parent 69c7dbcd50
commit 233497aceb
2 changed files with 12 additions and 2 deletions

View File

@ -2218,10 +2218,16 @@ fn rewrite_fn_base(
.map_or(false, |last_line| last_line.contains("//"));
if context.config.version() == Version::Two {
result.push(')');
if closing_paren_overflow_max_width || params_last_line_contains_comment {
if closing_paren_overflow_max_width {
result.push(')');
result.push_str(&indent.to_string_with_newline(context.config));
no_params_and_over_max_width = true;
} else if params_last_line_contains_comment {
result.push_str(&indent.to_string_with_newline(context.config));
result.push(')');
no_params_and_over_max_width = true;
} else {
result.push(')');
}
} else {
if closing_paren_overflow_max_width || params_last_line_contains_comment {

View File

@ -0,0 +1,4 @@
// rustfmt-version: Two
fn bar(_t: T, // bar
) {
}