@@ -95,7 +95,7 @@ pub struct State<'a> {
95
95
ann : & ' a ( dyn PpAnn + ' a ) ,
96
96
}
97
97
98
- crate const INDENT_UNIT : isize = 4 ;
98
+ pub ( crate ) const INDENT_UNIT : isize = 4 ;
99
99
100
100
/// Requires you to pass an input filename and reader so that
101
101
/// it can scan the input text for comments to copy forward.
@@ -955,8 +955,13 @@ impl<'a> State<'a> {
955
955
State { s : pp:: Printer :: new ( ) , comments : None , ann : & NoAnn }
956
956
}
957
957
958
- crate fn commasep_cmnt < T , F , G > ( & mut self , b : Breaks , elts : & [ T ] , mut op : F , mut get_span : G )
959
- where
958
+ pub ( crate ) fn commasep_cmnt < T , F , G > (
959
+ & mut self ,
960
+ b : Breaks ,
961
+ elts : & [ T ] ,
962
+ mut op : F ,
963
+ mut get_span : G ,
964
+ ) where
960
965
F : FnMut ( & mut State < ' _ > , & T ) ,
961
966
G : FnMut ( & T ) -> rustc_span:: Span ,
962
967
{
@@ -976,7 +981,7 @@ impl<'a> State<'a> {
976
981
self . end ( ) ;
977
982
}
978
983
979
- crate fn commasep_exprs ( & mut self , b : Breaks , exprs : & [ P < ast:: Expr > ] ) {
984
+ pub ( crate ) fn commasep_exprs ( & mut self , b : Breaks , exprs : & [ P < ast:: Expr > ] ) {
980
985
self . commasep_cmnt ( b, exprs, |s, e| s. print_expr ( e) , |e| e. span )
981
986
}
982
987
@@ -1109,7 +1114,7 @@ impl<'a> State<'a> {
1109
1114
self . print_trait_ref ( & t. trait_ref )
1110
1115
}
1111
1116
1112
- crate fn print_stmt ( & mut self , st : & ast:: Stmt ) {
1117
+ pub ( crate ) fn print_stmt ( & mut self , st : & ast:: Stmt ) {
1113
1118
self . maybe_print_comment ( st. span . lo ( ) ) ;
1114
1119
match st. kind {
1115
1120
ast:: StmtKind :: Local ( ref loc) => {
@@ -1164,19 +1169,19 @@ impl<'a> State<'a> {
1164
1169
self . maybe_print_trailing_comment ( st. span , None )
1165
1170
}
1166
1171
1167
- crate fn print_block ( & mut self , blk : & ast:: Block ) {
1172
+ pub ( crate ) fn print_block ( & mut self , blk : & ast:: Block ) {
1168
1173
self . print_block_with_attrs ( blk, & [ ] )
1169
1174
}
1170
1175
1171
- crate fn print_block_unclosed_indent ( & mut self , blk : & ast:: Block ) {
1176
+ pub ( crate ) fn print_block_unclosed_indent ( & mut self , blk : & ast:: Block ) {
1172
1177
self . print_block_maybe_unclosed ( blk, & [ ] , false )
1173
1178
}
1174
1179
1175
- crate fn print_block_with_attrs ( & mut self , blk : & ast:: Block , attrs : & [ ast:: Attribute ] ) {
1180
+ pub ( crate ) fn print_block_with_attrs ( & mut self , blk : & ast:: Block , attrs : & [ ast:: Attribute ] ) {
1176
1181
self . print_block_maybe_unclosed ( blk, attrs, true )
1177
1182
}
1178
1183
1179
- crate fn print_block_maybe_unclosed (
1184
+ pub ( crate ) fn print_block_maybe_unclosed (
1180
1185
& mut self ,
1181
1186
blk : & ast:: Block ,
1182
1187
attrs : & [ ast:: Attribute ] ,
@@ -1210,7 +1215,7 @@ impl<'a> State<'a> {
1210
1215
}
1211
1216
1212
1217
/// Print a `let pat = expr` expression.
1213
- crate fn print_let ( & mut self , pat : & ast:: Pat , expr : & ast:: Expr ) {
1218
+ pub ( crate ) fn print_let ( & mut self , pat : & ast:: Pat , expr : & ast:: Expr ) {
1214
1219
self . word ( "let " ) ;
1215
1220
self . print_pat ( pat) ;
1216
1221
self . space ( ) ;
@@ -1219,7 +1224,7 @@ impl<'a> State<'a> {
1219
1224
self . print_expr_cond_paren ( expr, Self :: cond_needs_par ( expr) || npals ( ) )
1220
1225
}
1221
1226
1222
- crate fn print_mac ( & mut self , m : & ast:: MacCall ) {
1227
+ pub ( crate ) fn print_mac ( & mut self , m : & ast:: MacCall ) {
1223
1228
self . print_mac_common (
1224
1229
Some ( MacHeader :: Path ( & m. path ) ) ,
1225
1230
true ,
@@ -1360,15 +1365,15 @@ impl<'a> State<'a> {
1360
1365
self . pclose ( ) ;
1361
1366
}
1362
1367
1363
- crate fn print_local_decl ( & mut self , loc : & ast:: Local ) {
1368
+ pub ( crate ) fn print_local_decl ( & mut self , loc : & ast:: Local ) {
1364
1369
self . print_pat ( & loc. pat ) ;
1365
1370
if let Some ( ref ty) = loc. ty {
1366
1371
self . word_space ( ":" ) ;
1367
1372
self . print_type ( ty) ;
1368
1373
}
1369
1374
}
1370
1375
1371
- crate fn print_name ( & mut self , name : Symbol ) {
1376
+ pub ( crate ) fn print_name ( & mut self , name : Symbol ) {
1372
1377
self . word ( name. to_string ( ) ) ;
1373
1378
self . ann . post ( self , AnnNode :: Name ( & name) )
1374
1379
}
@@ -1392,7 +1397,7 @@ impl<'a> State<'a> {
1392
1397
}
1393
1398
}
1394
1399
1395
- crate fn print_pat ( & mut self , pat : & ast:: Pat ) {
1400
+ pub ( crate ) fn print_pat ( & mut self , pat : & ast:: Pat ) {
1396
1401
self . maybe_print_comment ( pat. span . lo ( ) ) ;
1397
1402
self . ann . pre ( self , AnnNode :: Pat ( pat) ) ;
1398
1403
/* Pat isn't normalized, but the beauty of it
@@ -1551,7 +1556,7 @@ impl<'a> State<'a> {
1551
1556
}
1552
1557
}
1553
1558
1554
- crate fn print_asyncness ( & mut self , asyncness : ast:: Async ) {
1559
+ pub ( crate ) fn print_asyncness ( & mut self , asyncness : ast:: Async ) {
1555
1560
if asyncness. is_async ( ) {
1556
1561
self . word_nbsp ( "async" ) ;
1557
1562
}
@@ -1584,11 +1589,11 @@ impl<'a> State<'a> {
1584
1589
}
1585
1590
}
1586
1591
1587
- crate fn print_lifetime ( & mut self , lifetime : ast:: Lifetime ) {
1592
+ pub ( crate ) fn print_lifetime ( & mut self , lifetime : ast:: Lifetime ) {
1588
1593
self . print_name ( lifetime. ident . name )
1589
1594
}
1590
1595
1591
- crate fn print_lifetime_bounds (
1596
+ pub ( crate ) fn print_lifetime_bounds (
1592
1597
& mut self ,
1593
1598
lifetime : ast:: Lifetime ,
1594
1599
bounds : & ast:: GenericBounds ,
@@ -1608,7 +1613,7 @@ impl<'a> State<'a> {
1608
1613
}
1609
1614
}
1610
1615
1611
- crate fn print_generic_params ( & mut self , generic_params : & [ ast:: GenericParam ] ) {
1616
+ pub ( crate ) fn print_generic_params ( & mut self , generic_params : & [ ast:: GenericParam ] ) {
1612
1617
if generic_params. is_empty ( ) {
1613
1618
return ;
1614
1619
}
@@ -1662,12 +1667,12 @@ impl<'a> State<'a> {
1662
1667
}
1663
1668
}
1664
1669
1665
- crate fn print_mt ( & mut self , mt : & ast:: MutTy , print_const : bool ) {
1670
+ pub ( crate ) fn print_mt ( & mut self , mt : & ast:: MutTy , print_const : bool ) {
1666
1671
self . print_mutability ( mt. mutbl , print_const) ;
1667
1672
self . print_type ( & mt. ty )
1668
1673
}
1669
1674
1670
- crate fn print_param ( & mut self , input : & ast:: Param , is_closure : bool ) {
1675
+ pub ( crate ) fn print_param ( & mut self , input : & ast:: Param , is_closure : bool ) {
1671
1676
self . ibox ( INDENT_UNIT ) ;
1672
1677
1673
1678
self . print_outer_attributes_inline ( & input. attrs ) ;
@@ -1695,7 +1700,7 @@ impl<'a> State<'a> {
1695
1700
self . end ( ) ;
1696
1701
}
1697
1702
1698
- crate fn print_fn_ret_ty ( & mut self , fn_ret_ty : & ast:: FnRetTy ) {
1703
+ pub ( crate ) fn print_fn_ret_ty ( & mut self , fn_ret_ty : & ast:: FnRetTy ) {
1699
1704
if let ast:: FnRetTy :: Ty ( ty) = fn_ret_ty {
1700
1705
self . space_if_not_bol ( ) ;
1701
1706
self . ibox ( INDENT_UNIT ) ;
@@ -1706,7 +1711,7 @@ impl<'a> State<'a> {
1706
1711
}
1707
1712
}
1708
1713
1709
- crate fn print_ty_fn (
1714
+ pub ( crate ) fn print_ty_fn (
1710
1715
& mut self ,
1711
1716
ext : ast:: Extern ,
1712
1717
unsafety : ast:: Unsafe ,
@@ -1730,7 +1735,7 @@ impl<'a> State<'a> {
1730
1735
self . end ( ) ;
1731
1736
}
1732
1737
1733
- crate fn print_fn_header_info ( & mut self , header : ast:: FnHeader ) {
1738
+ pub ( crate ) fn print_fn_header_info ( & mut self , header : ast:: FnHeader ) {
1734
1739
self . print_constness ( header. constness ) ;
1735
1740
self . print_asyncness ( header. asyncness ) ;
1736
1741
self . print_unsafety ( header. unsafety ) ;
@@ -1750,21 +1755,21 @@ impl<'a> State<'a> {
1750
1755
self . word ( "fn" )
1751
1756
}
1752
1757
1753
- crate fn print_unsafety ( & mut self , s : ast:: Unsafe ) {
1758
+ pub ( crate ) fn print_unsafety ( & mut self , s : ast:: Unsafe ) {
1754
1759
match s {
1755
1760
ast:: Unsafe :: No => { }
1756
1761
ast:: Unsafe :: Yes ( _) => self . word_nbsp ( "unsafe" ) ,
1757
1762
}
1758
1763
}
1759
1764
1760
- crate fn print_constness ( & mut self , s : ast:: Const ) {
1765
+ pub ( crate ) fn print_constness ( & mut self , s : ast:: Const ) {
1761
1766
match s {
1762
1767
ast:: Const :: No => { }
1763
1768
ast:: Const :: Yes ( _) => self . word_nbsp ( "const" ) ,
1764
1769
}
1765
1770
}
1766
1771
1767
- crate fn print_is_auto ( & mut self , s : ast:: IsAuto ) {
1772
+ pub ( crate ) fn print_is_auto ( & mut self , s : ast:: IsAuto ) {
1768
1773
match s {
1769
1774
ast:: IsAuto :: Yes => self . word_nbsp ( "auto" ) ,
1770
1775
ast:: IsAuto :: No => { }
0 commit comments