@@ -216,15 +216,11 @@ pub trait PrettyPrinter<'tcx>:
216216 mut self ,
217217 f : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
218218 t : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
219- cast : bool ,
219+ conversion : & str ,
220220 ) -> Result < Self :: Const , Self :: Error > {
221221 self . write_str ( "{" ) ?;
222222 self = f ( self ) ?;
223- if cast {
224- self . write_str ( " as " ) ?;
225- } else {
226- self . write_str ( ": " ) ?;
227- }
223+ self . write_str ( conversion) ?;
228224 self = t ( self ) ?;
229225 self . write_str ( "}" ) ?;
230226 Ok ( self )
@@ -1008,7 +1004,7 @@ pub trait PrettyPrinter<'tcx>:
10081004 Ok ( this)
10091005 } ,
10101006 |this| this. print_type ( ty) ,
1011- true ,
1007+ " as " ,
10121008 ) ?;
10131009 }
10141010 ( Scalar :: Ptr ( ptr) , ty:: FnPtr ( _) ) => {
@@ -1019,7 +1015,7 @@ pub trait PrettyPrinter<'tcx>:
10191015 self = self . typed_value (
10201016 |this| this. print_value_path ( instance. def_id ( ) , instance. substs ) ,
10211017 |this| this. print_type ( ty) ,
1022- true ,
1018+ " as " ,
10231019 ) ?;
10241020 }
10251021 // For function type zsts just printing the type is enough
@@ -1048,7 +1044,7 @@ pub trait PrettyPrinter<'tcx>:
10481044 Ok ( this)
10491045 } ;
10501046 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) , ": " ) ?
10521048 } else {
10531049 print ( self ) ?
10541050 } ;
@@ -1076,7 +1072,7 @@ pub trait PrettyPrinter<'tcx>:
10761072 Ok ( this)
10771073 } ,
10781074 |this| this. print_type ( ty) ,
1079- false ,
1075+ ": " ,
10801076 )
10811077 } else {
10821078 self . write_str ( "&_" ) ?;
@@ -1477,15 +1473,11 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
14771473 mut self ,
14781474 f : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
14791475 t : impl FnOnce ( Self ) -> Result < Self , Self :: Error > ,
1480- cast : bool ,
1476+ conversion : & str ,
14811477 ) -> Result < Self :: Const , Self :: Error > {
14821478 self . write_str ( "{" ) ?;
14831479 self = f ( self ) ?;
1484- if cast {
1485- self . write_str ( " as " ) ?;
1486- } else {
1487- self . write_str ( ": " ) ?;
1488- }
1480+ self . write_str ( conversion) ?;
14891481 let was_in_value = std:: mem:: replace ( & mut self . in_value , false ) ;
14901482 self = t ( self ) ?;
14911483 self . in_value = was_in_value;
@@ -1566,7 +1558,7 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
15661558 Ok ( this)
15671559 } ;
15681560 if print_ty {
1569- self . typed_value ( print, |this| this. print_type ( ty) , false )
1561+ self . typed_value ( print, |this| this. print_type ( ty) , ": " )
15701562 } else {
15711563 print ( self )
15721564 }
0 commit comments