fix Unparsable code when formmating (#3883)
This commit is contained in:
parent
69c7dbcd50
commit
233497aceb
10
src/items.rs
10
src/items.rs
@ -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 {
|
||||
|
4
tests/target/issue-3882.rs
Normal file
4
tests/target/issue-3882.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-version: Two
|
||||
fn bar(_t: T, // bar
|
||||
) {
|
||||
}
|
Loading…
Reference in New Issue
Block a user