@@ -216,15 +216,11 @@ pub trait PrettyPrinter<'tcx>:
216
216
mut self ,
217
217
f : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
218
218
t : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
219
- cast : bool ,
219
+ conversion : & str ,
220
220
) -> Result < Self :: Const , Self :: Error > {
221
221
self . write_str ( "{" ) ?;
222
222
self = f ( self ) ?;
223
- if cast {
224
- self . write_str ( " as " ) ?;
225
- } else {
226
- self . write_str ( ": " ) ?;
227
- }
223
+ self . write_str ( conversion) ?;
228
224
self = t ( self ) ?;
229
225
self . write_str ( "}" ) ?;
230
226
Ok ( self )
@@ -1008,7 +1004,7 @@ pub trait PrettyPrinter<'tcx>:
1008
1004
Ok ( this)
1009
1005
} ,
1010
1006
|this| this. print_type ( ty) ,
1011
- true ,
1007
+ " as " ,
1012
1008
) ?;
1013
1009
}
1014
1010
( Scalar :: Ptr ( ptr) , ty:: FnPtr ( _) ) => {
@@ -1019,7 +1015,7 @@ pub trait PrettyPrinter<'tcx>:
1019
1015
self = self . typed_value (
1020
1016
|this| this. print_value_path ( instance. def_id ( ) , instance. substs ) ,
1021
1017
|this| this. print_type ( ty) ,
1022
- true ,
1018
+ " as " ,
1023
1019
) ?;
1024
1020
}
1025
1021
// For function type zsts just printing the type is enough
@@ -1048,7 +1044,7 @@ pub trait PrettyPrinter<'tcx>:
1048
1044
Ok ( this)
1049
1045
} ;
1050
1046
self = if print_ty {
1051
- self . typed_value ( print, |this| this. print_type ( ty) , false ) ?
1047
+ self . typed_value ( print, |this| this. print_type ( ty) , ": " ) ?
1052
1048
} else {
1053
1049
print ( self ) ?
1054
1050
} ;
@@ -1076,7 +1072,7 @@ pub trait PrettyPrinter<'tcx>:
1076
1072
Ok ( this)
1077
1073
} ,
1078
1074
|this| this. print_type ( ty) ,
1079
- false ,
1075
+ ": " ,
1080
1076
)
1081
1077
} else {
1082
1078
self . write_str ( "&_" ) ?;
@@ -1477,15 +1473,11 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
1477
1473
mut self ,
1478
1474
f : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
1479
1475
t : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
1480
- cast : bool ,
1476
+ conversion : & str ,
1481
1477
) -> Result < Self :: Const , Self :: Error > {
1482
1478
self . write_str ( "{" ) ?;
1483
1479
self = f ( self ) ?;
1484
- if cast {
1485
- self . write_str ( " as " ) ?;
1486
- } else {
1487
- self . write_str ( ": " ) ?;
1488
- }
1480
+ self . write_str ( conversion) ?;
1489
1481
let was_in_value = std:: mem:: replace ( & mut self . in_value , false ) ;
1490
1482
self = t ( self ) ?;
1491
1483
self . in_value = was_in_value;
@@ -1566,7 +1558,7 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
1566
1558
Ok ( this)
1567
1559
} ;
1568
1560
if print_ty {
1569
- self . typed_value ( print, |this| this. print_type ( ty) , false )
1561
+ self . typed_value ( print, |this| this. print_type ( ty) , ": " )
1570
1562
} else {
1571
1563
print ( self )
1572
1564
}
0 commit comments