File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -698,11 +698,13 @@ fn write_rust_function_shim_impl(
698
698
write ! ( out, "::rust::repr::PtrLen error$ = " ) ;
699
699
}
700
700
write ! ( out, "{}(" , invoke) ;
701
+ let mut needs_comma = false ;
701
702
if sig. receiver . is_some ( ) {
702
703
write ! ( out, "*this" ) ;
704
+ needs_comma = true ;
703
705
}
704
- for ( i , arg) in sig. args . iter ( ) . enumerate ( ) {
705
- if i > 0 || sig . receiver . is_some ( ) {
706
+ for arg in & sig. args {
707
+ if needs_comma {
706
708
write ! ( out, ", " ) ;
707
709
}
708
710
match & arg. ty {
@@ -725,15 +727,17 @@ fn write_rust_function_shim_impl(
725
727
ty if ty != RustString && out. types . needs_indirect_abi ( ty) => write ! ( out, "$.value" ) ,
726
728
_ => { }
727
729
}
730
+ needs_comma = true ;
728
731
}
729
732
if indirect_return {
730
- if !sig . args . is_empty ( ) {
733
+ if needs_comma {
731
734
write ! ( out, ", " ) ;
732
735
}
733
736
write ! ( out, "&return$.value" ) ;
737
+ needs_comma = true ;
734
738
}
735
739
if indirect_call {
736
- if !sig . args . is_empty ( ) || indirect_return {
740
+ if needs_comma {
737
741
write ! ( out, ", " ) ;
738
742
}
739
743
write ! ( out, "extern$" ) ;
You can’t perform that action at this time.
0 commit comments