@@ -43,8 +43,7 @@ pub trait PpAnn {
43
43
fn post ( & self , _state : & mut State < ' _ > , _node : AnnNode < ' _ > ) { }
44
44
}
45
45
46
- #[ derive( Copy , Clone ) ]
47
- pub struct NoAnn ;
46
+ struct NoAnn ;
48
47
49
48
impl PpAnn for NoAnn { }
50
49
@@ -61,11 +60,11 @@ impl<'a> Comments<'a> {
61
60
}
62
61
63
62
// FIXME: This shouldn't probably clone lmao
64
- pub fn next ( & self ) -> Option < Comment > {
63
+ fn next ( & self ) -> Option < Comment > {
65
64
self . comments . get ( self . current ) . cloned ( )
66
65
}
67
66
68
- pub fn trailing_comment (
67
+ fn trailing_comment (
69
68
& self ,
70
69
span : rustc_span:: Span ,
71
70
next_pos : Option < BytePos > ,
@@ -92,7 +91,7 @@ pub struct State<'a> {
92
91
ann : & ' a ( dyn PpAnn + ' a ) ,
93
92
}
94
93
95
- pub ( crate ) const INDENT_UNIT : isize = 4 ;
94
+ const INDENT_UNIT : isize = 4 ;
96
95
97
96
/// Requires you to pass an input filename and reader so that
98
97
/// it can scan the input text for comments to copy forward.
@@ -217,7 +216,7 @@ fn doc_comment_to_string(
217
216
}
218
217
}
219
218
220
- pub fn literal_to_string ( lit : token:: Lit ) -> String {
219
+ fn literal_to_string ( lit : token:: Lit ) -> String {
221
220
let token:: Lit { kind, symbol, suffix } = lit;
222
221
let mut out = match kind {
223
222
token:: Byte => format ! ( "b'{symbol}'" ) ,
@@ -976,13 +975,8 @@ impl<'a> State<'a> {
976
975
State { s : pp:: Printer :: new ( ) , comments : None , ann : & NoAnn }
977
976
}
978
977
979
- pub ( crate ) fn commasep_cmnt < T , F , G > (
980
- & mut self ,
981
- b : Breaks ,
982
- elts : & [ T ] ,
983
- mut op : F ,
984
- mut get_span : G ,
985
- ) where
978
+ fn commasep_cmnt < T , F , G > ( & mut self , b : Breaks , elts : & [ T ] , mut op : F , mut get_span : G )
979
+ where
986
980
F : FnMut ( & mut State < ' _ > , & T ) ,
987
981
G : FnMut ( & T ) -> rustc_span:: Span ,
988
982
{
@@ -1002,7 +996,7 @@ impl<'a> State<'a> {
1002
996
self . end ( ) ;
1003
997
}
1004
998
1005
- pub ( crate ) fn commasep_exprs ( & mut self , b : Breaks , exprs : & [ P < ast:: Expr > ] ) {
999
+ fn commasep_exprs ( & mut self , b : Breaks , exprs : & [ P < ast:: Expr > ] ) {
1006
1000
self . commasep_cmnt ( b, exprs, |s, e| s. print_expr ( e) , |e| e. span )
1007
1001
}
1008
1002
@@ -1153,7 +1147,7 @@ impl<'a> State<'a> {
1153
1147
self . print_trait_ref ( & t. trait_ref )
1154
1148
}
1155
1149
1156
- pub ( crate ) fn print_stmt ( & mut self , st : & ast:: Stmt ) {
1150
+ fn print_stmt ( & mut self , st : & ast:: Stmt ) {
1157
1151
self . maybe_print_comment ( st. span . lo ( ) ) ;
1158
1152
match & st. kind {
1159
1153
ast:: StmtKind :: Local ( loc) => {
@@ -1208,19 +1202,19 @@ impl<'a> State<'a> {
1208
1202
self . maybe_print_trailing_comment ( st. span , None )
1209
1203
}
1210
1204
1211
- pub ( crate ) fn print_block ( & mut self , blk : & ast:: Block ) {
1205
+ fn print_block ( & mut self , blk : & ast:: Block ) {
1212
1206
self . print_block_with_attrs ( blk, & [ ] )
1213
1207
}
1214
1208
1215
- pub ( crate ) fn print_block_unclosed_indent ( & mut self , blk : & ast:: Block ) {
1209
+ fn print_block_unclosed_indent ( & mut self , blk : & ast:: Block ) {
1216
1210
self . print_block_maybe_unclosed ( blk, & [ ] , false )
1217
1211
}
1218
1212
1219
- pub ( crate ) fn print_block_with_attrs ( & mut self , blk : & ast:: Block , attrs : & [ ast:: Attribute ] ) {
1213
+ fn print_block_with_attrs ( & mut self , blk : & ast:: Block , attrs : & [ ast:: Attribute ] ) {
1220
1214
self . print_block_maybe_unclosed ( blk, attrs, true )
1221
1215
}
1222
1216
1223
- pub ( crate ) fn print_block_maybe_unclosed (
1217
+ fn print_block_maybe_unclosed (
1224
1218
& mut self ,
1225
1219
blk : & ast:: Block ,
1226
1220
attrs : & [ ast:: Attribute ] ,
@@ -1254,7 +1248,7 @@ impl<'a> State<'a> {
1254
1248
}
1255
1249
1256
1250
/// Print a `let pat = expr` expression.
1257
- pub ( crate ) fn print_let ( & mut self , pat : & ast:: Pat , expr : & ast:: Expr ) {
1251
+ fn print_let ( & mut self , pat : & ast:: Pat , expr : & ast:: Expr ) {
1258
1252
self . word ( "let " ) ;
1259
1253
self . print_pat ( pat) ;
1260
1254
self . space ( ) ;
@@ -1263,7 +1257,7 @@ impl<'a> State<'a> {
1263
1257
self . print_expr_cond_paren ( expr, Self :: cond_needs_par ( expr) || npals ( ) )
1264
1258
}
1265
1259
1266
- pub ( crate ) fn print_mac ( & mut self , m : & ast:: MacCall ) {
1260
+ fn print_mac ( & mut self , m : & ast:: MacCall ) {
1267
1261
self . print_mac_common (
1268
1262
Some ( MacHeader :: Path ( & m. path ) ) ,
1269
1263
true ,
@@ -1404,15 +1398,15 @@ impl<'a> State<'a> {
1404
1398
self . pclose ( ) ;
1405
1399
}
1406
1400
1407
- pub ( crate ) fn print_local_decl ( & mut self , loc : & ast:: Local ) {
1401
+ fn print_local_decl ( & mut self , loc : & ast:: Local ) {
1408
1402
self . print_pat ( & loc. pat ) ;
1409
1403
if let Some ( ty) = & loc. ty {
1410
1404
self . word_space ( ":" ) ;
1411
1405
self . print_type ( ty) ;
1412
1406
}
1413
1407
}
1414
1408
1415
- pub ( crate ) fn print_name ( & mut self , name : Symbol ) {
1409
+ fn print_name ( & mut self , name : Symbol ) {
1416
1410
self . word ( name. to_string ( ) ) ;
1417
1411
self . ann . post ( self , AnnNode :: Name ( & name) )
1418
1412
}
@@ -1436,7 +1430,7 @@ impl<'a> State<'a> {
1436
1430
}
1437
1431
}
1438
1432
1439
- pub ( crate ) fn print_pat ( & mut self , pat : & ast:: Pat ) {
1433
+ fn print_pat ( & mut self , pat : & ast:: Pat ) {
1440
1434
self . maybe_print_comment ( pat. span . lo ( ) ) ;
1441
1435
self . ann . pre ( self , AnnNode :: Pat ( pat) ) ;
1442
1436
/* Pat isn't normalized, but the beauty of it
@@ -1589,7 +1583,7 @@ impl<'a> State<'a> {
1589
1583
}
1590
1584
}
1591
1585
1592
- pub ( crate ) fn print_asyncness ( & mut self , asyncness : ast:: Async ) {
1586
+ fn print_asyncness ( & mut self , asyncness : ast:: Async ) {
1593
1587
if asyncness. is_async ( ) {
1594
1588
self . word_nbsp ( "async" ) ;
1595
1589
}
@@ -1634,11 +1628,11 @@ impl<'a> State<'a> {
1634
1628
}
1635
1629
}
1636
1630
1637
- pub ( crate ) fn print_lifetime ( & mut self , lifetime : ast:: Lifetime ) {
1631
+ fn print_lifetime ( & mut self , lifetime : ast:: Lifetime ) {
1638
1632
self . print_name ( lifetime. ident . name )
1639
1633
}
1640
1634
1641
- pub ( crate ) fn print_lifetime_bounds ( & mut self , bounds : & ast:: GenericBounds ) {
1635
+ fn print_lifetime_bounds ( & mut self , bounds : & ast:: GenericBounds ) {
1642
1636
for ( i, bound) in bounds. iter ( ) . enumerate ( ) {
1643
1637
if i != 0 {
1644
1638
self . word ( " + " ) ;
@@ -1650,7 +1644,7 @@ impl<'a> State<'a> {
1650
1644
}
1651
1645
}
1652
1646
1653
- pub ( crate ) fn print_generic_params ( & mut self , generic_params : & [ ast:: GenericParam ] ) {
1647
+ fn print_generic_params ( & mut self , generic_params : & [ ast:: GenericParam ] ) {
1654
1648
if generic_params. is_empty ( ) {
1655
1649
return ;
1656
1650
}
@@ -1714,12 +1708,12 @@ impl<'a> State<'a> {
1714
1708
}
1715
1709
}
1716
1710
1717
- pub ( crate ) fn print_mt ( & mut self , mt : & ast:: MutTy , print_const : bool ) {
1711
+ fn print_mt ( & mut self , mt : & ast:: MutTy , print_const : bool ) {
1718
1712
self . print_mutability ( mt. mutbl , print_const) ;
1719
1713
self . print_type ( & mt. ty )
1720
1714
}
1721
1715
1722
- pub ( crate ) fn print_param ( & mut self , input : & ast:: Param , is_closure : bool ) {
1716
+ fn print_param ( & mut self , input : & ast:: Param , is_closure : bool ) {
1723
1717
self . ibox ( INDENT_UNIT ) ;
1724
1718
1725
1719
self . print_outer_attributes_inline ( & input. attrs ) ;
@@ -1747,7 +1741,7 @@ impl<'a> State<'a> {
1747
1741
self . end ( ) ;
1748
1742
}
1749
1743
1750
- pub ( crate ) fn print_fn_ret_ty ( & mut self , fn_ret_ty : & ast:: FnRetTy ) {
1744
+ fn print_fn_ret_ty ( & mut self , fn_ret_ty : & ast:: FnRetTy ) {
1751
1745
if let ast:: FnRetTy :: Ty ( ty) = fn_ret_ty {
1752
1746
self . space_if_not_bol ( ) ;
1753
1747
self . ibox ( INDENT_UNIT ) ;
@@ -1758,7 +1752,7 @@ impl<'a> State<'a> {
1758
1752
}
1759
1753
}
1760
1754
1761
- pub ( crate ) fn print_ty_fn (
1755
+ fn print_ty_fn (
1762
1756
& mut self ,
1763
1757
ext : ast:: Extern ,
1764
1758
unsafety : ast:: Unsafe ,
@@ -1782,7 +1776,7 @@ impl<'a> State<'a> {
1782
1776
self . end ( ) ;
1783
1777
}
1784
1778
1785
- pub ( crate ) fn print_fn_header_info ( & mut self , header : ast:: FnHeader ) {
1779
+ fn print_fn_header_info ( & mut self , header : ast:: FnHeader ) {
1786
1780
self . print_constness ( header. constness ) ;
1787
1781
self . print_asyncness ( header. asyncness ) ;
1788
1782
self . print_unsafety ( header. unsafety ) ;
@@ -1802,21 +1796,21 @@ impl<'a> State<'a> {
1802
1796
self . word ( "fn" )
1803
1797
}
1804
1798
1805
- pub ( crate ) fn print_unsafety ( & mut self , s : ast:: Unsafe ) {
1799
+ fn print_unsafety ( & mut self , s : ast:: Unsafe ) {
1806
1800
match s {
1807
1801
ast:: Unsafe :: No => { }
1808
1802
ast:: Unsafe :: Yes ( _) => self . word_nbsp ( "unsafe" ) ,
1809
1803
}
1810
1804
}
1811
1805
1812
- pub ( crate ) fn print_constness ( & mut self , s : ast:: Const ) {
1806
+ fn print_constness ( & mut self , s : ast:: Const ) {
1813
1807
match s {
1814
1808
ast:: Const :: No => { }
1815
1809
ast:: Const :: Yes ( _) => self . word_nbsp ( "const" ) ,
1816
1810
}
1817
1811
}
1818
1812
1819
- pub ( crate ) fn print_is_auto ( & mut self , s : ast:: IsAuto ) {
1813
+ fn print_is_auto ( & mut self , s : ast:: IsAuto ) {
1820
1814
match s {
1821
1815
ast:: IsAuto :: Yes => self . word_nbsp ( "auto" ) ,
1822
1816
ast:: IsAuto :: No => { }
0 commit comments