@@ -1438,13 +1438,9 @@ impl clean::FnDecl {
1438
1438
{
1439
1439
write ! ( f, "\n {}" , Indent ( n + 4 ) ) ?;
1440
1440
}
1441
+
1442
+ let last_input_index = self . inputs . values . len ( ) . checked_sub ( 1 ) ;
1441
1443
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
- }
1448
1444
if let Some ( selfty) = input. to_self ( ) {
1449
1445
match selfty {
1450
1446
clean:: SelfValue => {
@@ -1477,18 +1473,25 @@ impl clean::FnDecl {
1477
1473
write ! ( f, "{}: " , input. name) ?;
1478
1474
input. type_ . print ( cx) . fmt ( f) ?;
1479
1475
}
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
+ }
1480
1483
}
1481
1484
1482
1485
if self . c_variadic {
1483
1486
match line_wrapping_indent {
1484
1487
None => write ! ( f, ", ..." ) ?,
1485
- Some ( n) => write ! ( f, "\n {}..." , Indent ( n + 4 ) ) ?,
1488
+ Some ( n) => write ! ( f, "{}...\n " , Indent ( n + 4 ) ) ?,
1486
1489
} ;
1487
1490
}
1488
1491
1489
1492
match line_wrapping_indent {
1490
1493
None => write ! ( f, ")" ) ?,
1491
- Some ( n) => write ! ( f, "\n {})" , Indent ( n) ) ?,
1494
+ Some ( n) => write ! ( f, "{})" , Indent ( n) ) ?,
1492
1495
} ;
1493
1496
1494
1497
self . print_output ( cx) . fmt ( f)
0 commit comments