@@ -96,8 +96,7 @@ impl<'a> PrintState<'a> for State<'a> {
9696 }
9797}
9898
99- #[ allow( non_upper_case_globals) ]
100- pub const indent_unit: usize = 4 ;
99+ pub const INDENT_UNIT : usize = 4 ;
101100
102101/// Requires you to pass an input filename and reader so that
103102/// it can scan the input text for comments to copy forward.
@@ -168,7 +167,7 @@ impl<'a> State<'a> {
168167 pub fn head < S : Into < Cow < ' static , str > > > ( & mut self , w : S ) {
169168 let w = w. into ( ) ;
170169 // outer-box is consistent
171- self . cbox ( indent_unit ) ;
170+ self . cbox ( INDENT_UNIT ) ;
172171 // head-box is inconsistent
173172 self . ibox ( w. len ( ) + 1 ) ;
174173 // keyword that starts the head
@@ -196,7 +195,7 @@ impl<'a> State<'a> {
196195 }
197196
198197 pub fn bclose ( & mut self , span : syntax_pos:: Span ) {
199- self . bclose_maybe_open ( span, indent_unit , true )
198+ self . bclose_maybe_open ( span, INDENT_UNIT , true )
200199 }
201200
202201 pub fn space_if_not_bol ( & mut self ) {
@@ -732,7 +731,7 @@ impl<'a> State<'a> {
732731 self . space_if_not_bol ( ) ;
733732 self . maybe_print_comment ( v. span . lo ( ) ) ;
734733 self . print_outer_attributes ( & v. node . attrs ) ;
735- self . ibox ( indent_unit ) ;
734+ self . ibox ( INDENT_UNIT ) ;
736735 self . print_variant ( v) ;
737736 self . s . word ( "," ) ;
738737 self . end ( ) ;
@@ -919,10 +918,10 @@ impl<'a> State<'a> {
919918 decl : impl Fn ( & mut Self )
920919 ) {
921920 self . space_if_not_bol ( ) ;
922- self . ibox ( indent_unit ) ;
921+ self . ibox ( INDENT_UNIT ) ;
923922 self . word_nbsp ( "let" ) ;
924923
925- self . ibox ( indent_unit ) ;
924+ self . ibox ( INDENT_UNIT ) ;
926925 decl ( self ) ;
927926 self . end ( ) ;
928927
@@ -964,7 +963,7 @@ impl<'a> State<'a> {
964963 }
965964
966965 pub fn print_block_unclosed ( & mut self , blk : & hir:: Block ) {
967- self . print_block_unclosed_indent ( blk, indent_unit )
966+ self . print_block_unclosed_indent ( blk, INDENT_UNIT )
968967 }
969968
970969 pub fn print_block_unclosed_indent ( & mut self ,
@@ -978,7 +977,7 @@ impl<'a> State<'a> {
978977 blk : & hir:: Block ,
979978 attrs : & [ ast:: Attribute ] )
980979 {
981- self . print_block_maybe_unclosed ( blk, indent_unit , attrs, true )
980+ self . print_block_maybe_unclosed ( blk, INDENT_UNIT , attrs, true )
982981 }
983982
984983 pub fn print_block_maybe_unclosed ( & mut self ,
@@ -1055,15 +1054,15 @@ impl<'a> State<'a> {
10551054 }
10561055
10571056 fn print_expr_vec ( & mut self , exprs : & [ hir:: Expr ] ) {
1058- self . ibox ( indent_unit ) ;
1057+ self . ibox ( INDENT_UNIT ) ;
10591058 self . s . word ( "[" ) ;
10601059 self . commasep_exprs ( Inconsistent , exprs) ;
10611060 self . s . word ( "]" ) ;
10621061 self . end ( )
10631062 }
10641063
10651064 fn print_expr_repeat ( & mut self , element : & hir:: Expr , count : & hir:: AnonConst ) {
1066- self . ibox ( indent_unit ) ;
1065+ self . ibox ( INDENT_UNIT ) ;
10671066 self . s . word ( "[" ) ;
10681067 self . print_expr ( element) ;
10691068 self . word_space ( ";" ) ;
@@ -1082,7 +1081,7 @@ impl<'a> State<'a> {
10821081 self . commasep_cmnt ( Consistent ,
10831082 & fields[ ..] ,
10841083 |s, field| {
1085- s. ibox ( indent_unit ) ;
1084+ s. ibox ( INDENT_UNIT ) ;
10861085 if !field. is_shorthand {
10871086 s. print_ident ( field. ident ) ;
10881087 s. word_space ( ":" ) ;
@@ -1093,7 +1092,7 @@ impl<'a> State<'a> {
10931092 |f| f. span ) ;
10941093 match * wth {
10951094 Some ( ref expr) => {
1096- self . ibox ( indent_unit ) ;
1095+ self . ibox ( INDENT_UNIT ) ;
10971096 if !fields. is_empty ( ) {
10981097 self . s . word ( "," ) ;
10991098 self . s . space ( ) ;
@@ -1198,7 +1197,7 @@ impl<'a> State<'a> {
11981197 pub fn print_expr ( & mut self , expr : & hir:: Expr ) {
11991198 self . maybe_print_comment ( expr. span . lo ( ) ) ;
12001199 self . print_outer_attributes ( & expr. attrs ) ;
1201- self . ibox ( indent_unit ) ;
1200+ self . ibox ( INDENT_UNIT ) ;
12021201 self . ann . pre ( self , AnnNode :: Expr ( expr) ) ;
12031202 match expr. node {
12041203 hir:: ExprKind :: Box ( ref expr) => {
@@ -1250,7 +1249,7 @@ impl<'a> State<'a> {
12501249 }
12511250 hir:: ExprKind :: DropTemps ( ref init) => {
12521251 // Print `{`:
1253- self . cbox ( indent_unit ) ;
1252+ self . cbox ( INDENT_UNIT ) ;
12541253 self . ibox ( 0 ) ;
12551254 self . bopen ( ) ;
12561255
@@ -1264,7 +1263,7 @@ impl<'a> State<'a> {
12641263 self . print_ident ( temp) ;
12651264
12661265 // Print `}`:
1267- self . bclose_maybe_open ( expr. span , indent_unit , true ) ;
1266+ self . bclose_maybe_open ( expr. span , INDENT_UNIT , true ) ;
12681267 }
12691268 hir:: ExprKind :: Loop ( ref blk, opt_label, _) => {
12701269 if let Some ( label) = opt_label {
@@ -1276,7 +1275,7 @@ impl<'a> State<'a> {
12761275 self . print_block ( & blk) ;
12771276 }
12781277 hir:: ExprKind :: Match ( ref expr, ref arms, _) => {
1279- self . cbox ( indent_unit ) ;
1278+ self . cbox ( INDENT_UNIT ) ;
12801279 self . ibox ( 4 ) ;
12811280 self . word_nbsp ( "match" ) ;
12821281 self . print_expr_as_cond ( & expr) ;
@@ -1308,7 +1307,7 @@ impl<'a> State<'a> {
13081307 self . word_space ( ":" ) ;
13091308 }
13101309 // containing cbox, will be closed by print-block at }
1311- self . cbox ( indent_unit ) ;
1310+ self . cbox ( INDENT_UNIT ) ;
13121311 // head-box, will be closed by print-block after {
13131312 self . ibox ( 0 ) ;
13141313 self . print_block ( & blk) ;
@@ -1678,7 +1677,7 @@ impl<'a> State<'a> {
16781677 self . commasep_cmnt ( Consistent ,
16791678 & fields[ ..] ,
16801679 |s, f| {
1681- s. cbox ( indent_unit ) ;
1680+ s. cbox ( INDENT_UNIT ) ;
16821681 if !f. node . is_shorthand {
16831682 s. print_ident ( f. node . ident ) ;
16841683 s. word_nbsp ( ":" ) ;
@@ -1787,7 +1786,7 @@ impl<'a> State<'a> {
17871786 if arm. attrs . is_empty ( ) {
17881787 self . s . space ( ) ;
17891788 }
1790- self . cbox ( indent_unit ) ;
1789+ self . cbox ( INDENT_UNIT ) ;
17911790 self . ann . pre ( self , AnnNode :: Arm ( arm) ) ;
17921791 self . ibox ( 0 ) ;
17931792 self . print_outer_attributes ( & arm. attrs ) ;
@@ -1820,7 +1819,7 @@ impl<'a> State<'a> {
18201819 self . word_space ( ":" ) ;
18211820 }
18221821 // the block will close the pattern's ibox
1823- self . print_block_unclosed_indent ( & blk, indent_unit ) ;
1822+ self . print_block_unclosed_indent ( & blk, INDENT_UNIT ) ;
18241823
18251824 // If it is a user-provided unsafe block, print a comma after it
18261825 if let hir:: UnsafeBlock ( hir:: UserProvided ) = blk. rules {
@@ -1859,7 +1858,7 @@ impl<'a> State<'a> {
18591858 // Make sure we aren't supplied *both* `arg_names` and `body_id`.
18601859 assert ! ( arg_names. is_empty( ) || body_id. is_none( ) ) ;
18611860 self . commasep ( Inconsistent , & decl. inputs , |s, ty| {
1862- s. ibox ( indent_unit ) ;
1861+ s. ibox ( INDENT_UNIT ) ;
18631862 if let Some ( arg_name) = arg_names. get ( i) {
18641863 s. s . word ( arg_name. as_str ( ) . to_string ( ) ) ;
18651864 s. s . word ( ":" ) ;
@@ -1886,7 +1885,7 @@ impl<'a> State<'a> {
18861885 self . s . word ( "|" ) ;
18871886 let mut i = 0 ;
18881887 self . commasep ( Inconsistent , & decl. inputs , |s, ty| {
1889- s. ibox ( indent_unit ) ;
1888+ s. ibox ( INDENT_UNIT ) ;
18901889
18911890 s. ann . nested ( s, Nested :: BodyArgPat ( body_id, i) ) ;
18921891 i += 1 ;
@@ -2085,7 +2084,7 @@ impl<'a> State<'a> {
20852084 }
20862085
20872086 self . space_if_not_bol ( ) ;
2088- self . ibox ( indent_unit ) ;
2087+ self . ibox ( INDENT_UNIT ) ;
20892088 self . word_space ( "->" ) ;
20902089 match decl. output {
20912090 hir:: DefaultReturn ( ..) => unreachable ! ( ) ,
@@ -2107,7 +2106,7 @@ impl<'a> State<'a> {
21072106 generic_params : & [ hir:: GenericParam ] ,
21082107 arg_names : & [ ast:: Ident ] )
21092108 {
2110- self . ibox ( indent_unit ) ;
2109+ self . ibox ( INDENT_UNIT ) ;
21112110 if !generic_params. is_empty ( ) {
21122111 self . s . word ( "for" ) ;
21132112 self . print_generic_params ( generic_params) ;
0 commit comments