@@ -1438,13 +1438,9 @@ impl clean::FnDecl {
14381438 {
14391439 write ! ( f, "\n {}" , Indent ( n + 4 ) ) ?;
14401440 }
1441+
1442+ let last_input_index = self . inputs . values . len ( ) . checked_sub ( 1 ) ;
14411443 for ( i, input) in self . inputs . values . iter ( ) . enumerate ( ) {
1442- if i > 0 {
1443- match line_wrapping_indent {
1444- None => write ! ( f, ", " ) ?,
1445- Some ( n) => write ! ( f, ",\n {}" , Indent ( n + 4 ) ) ?,
1446- } ;
1447- }
14481444 if let Some ( selfty) = input. to_self ( ) {
14491445 match selfty {
14501446 clean:: SelfValue => {
@@ -1477,18 +1473,25 @@ impl clean::FnDecl {
14771473 write ! ( f, "{}: " , input. name) ?;
14781474 input. type_ . print ( cx) . fmt ( f) ?;
14791475 }
1476+ match ( line_wrapping_indent, last_input_index) {
1477+ ( _, None ) => ( ) ,
1478+ ( None , Some ( last_i) ) if i != last_i => write ! ( f, ", " ) ?,
1479+ ( None , Some ( _) ) => ( ) ,
1480+ ( Some ( n) , Some ( last_i) ) if i != last_i => write ! ( f, ",\n {}" , Indent ( n + 4 ) ) ?,
1481+ ( Some ( _) , Some ( _) ) => write ! ( f, ",\n " ) ?,
1482+ }
14801483 }
14811484
14821485 if self . c_variadic {
14831486 match line_wrapping_indent {
14841487 None => write ! ( f, ", ..." ) ?,
1485- Some ( n) => write ! ( f, "\n {}..." , Indent ( n + 4 ) ) ?,
1488+ Some ( n) => write ! ( f, "{}...\n " , Indent ( n + 4 ) ) ?,
14861489 } ;
14871490 }
14881491
14891492 match line_wrapping_indent {
14901493 None => write ! ( f, ")" ) ?,
1491- Some ( n) => write ! ( f, "\n {})" , Indent ( n) ) ?,
1494+ Some ( n) => write ! ( f, "{})" , Indent ( n) ) ?,
14921495 } ;
14931496
14941497 self . print_output ( cx) . fmt ( f)
0 commit comments