File tree 1 file changed +10
-14
lines changed
compiler/rustc_type_ir/src
1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -564,22 +564,18 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
564
564
}
565
565
Never => write ! ( f, "!" ) ,
566
566
Tuple ( t) => {
567
- let mut iter = t. clone ( ) . into_iter ( ) ;
568
-
569
567
write ! ( f, "(" ) ?;
570
-
571
- match iter. next ( ) {
572
- None => return write ! ( f, ")" ) ,
573
- Some ( ty) => write ! ( f, "{:?}" , & this. wrap( ty) ) ?,
574
- } ;
575
-
576
- match iter. next ( ) {
577
- None => return write ! ( f, ",)" ) ,
578
- Some ( ty) => write ! ( f, "{:?})" , & this. wrap( ty) ) ?,
568
+ let mut count = 0 ;
569
+ for ty in t. clone ( ) {
570
+ if count > 0 {
571
+ write ! ( f, ", " ) ?;
572
+ }
573
+ write ! ( f, "{:?}" , & this. wrap( ty) ) ?;
574
+ count += 1 ;
579
575
}
580
-
581
- for ty in iter {
582
- write ! ( f, ", {:?}" , & this . wrap ( ty ) ) ?;
576
+ // unary tuples need a trailing comma
577
+ if count == 1 {
578
+ write ! ( f, "," ) ?;
583
579
}
584
580
write ! ( f, ")" )
585
581
}
You can’t perform that action at this time.
0 commit comments