This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -2040,18 +2040,16 @@ fn rewrite_fn_base(
2040
2040
let used_width = last_line_used_width ( & result, indent. width ( ) ) + first_line_width ( & ret_str) ;
2041
2041
// Put the closing brace on the next line if it overflows the max width.
2042
2042
// 1 = `)`
2043
- if fd. inputs . is_empty ( ) && used_width + 1 > context. config . max_width ( ) {
2044
- result. push ( '\n' ) ;
2045
- }
2043
+ let closing_paren_overflow_max_width =
2044
+ fd. inputs . is_empty ( ) && used_width + 1 > context. config . max_width ( ) ;
2046
2045
// If the last line of args contains comment, we cannot put the closing paren
2047
2046
// on the same line.
2048
- if arg_str
2047
+ args_last_line_contains_comment = arg_str
2049
2048
. lines ( )
2050
2049
. last ( )
2051
- . map_or ( false , |last_line| last_line. contains ( "//" ) )
2052
- {
2053
- args_last_line_contains_comment = true ;
2054
- result. push_str ( & arg_indent. to_string_with_newline ( context. config ) ) ;
2050
+ . map_or ( false , |last_line| last_line. contains ( "//" ) ) ;
2051
+ if closing_paren_overflow_max_width || args_last_line_contains_comment {
2052
+ result. push_str ( & indent. to_string_with_newline ( context. config ) ) ;
2055
2053
}
2056
2054
result. push ( ')' ) ;
2057
2055
}
You can’t perform that action at this time.
0 commit comments