@@ -10,7 +10,7 @@ use rustc_hir::{GenericArg, GenericParam, GenericParamKind, Node};
10
10
use rustc_hir:: { GenericBound , PatKind , RangeEnd , TraitBoundModifier } ;
11
11
use rustc_span:: source_map:: { SourceMap , Spanned } ;
12
12
use rustc_span:: symbol:: { kw, Ident , IdentPrinter , Symbol } ;
13
- use rustc_span:: { self , BytePos , FileName } ;
13
+ use rustc_span:: { self , FileName } ;
14
14
use rustc_target:: spec:: abi:: Abi ;
15
15
16
16
use std:: borrow:: Cow ;
@@ -241,36 +241,6 @@ pub fn enum_def_to_string(
241
241
}
242
242
243
243
impl < ' a > State < ' a > {
244
- pub fn cbox ( & mut self , u : usize ) {
245
- self . s . cbox ( u) ;
246
- }
247
-
248
- pub fn nbsp ( & mut self ) {
249
- self . s . word ( " " )
250
- }
251
-
252
- pub fn word_nbsp < S : Into < Cow < ' static , str > > > ( & mut self , w : S ) {
253
- self . s . word ( w) ;
254
- self . nbsp ( )
255
- }
256
-
257
- pub fn head < S : Into < Cow < ' static , str > > > ( & mut self , w : S ) {
258
- let w = w. into ( ) ;
259
- // outer-box is consistent
260
- self . cbox ( INDENT_UNIT ) ;
261
- // head-box is inconsistent
262
- self . ibox ( w. len ( ) + 1 ) ;
263
- // keyword that starts the head
264
- if !w. is_empty ( ) {
265
- self . word_nbsp ( w) ;
266
- }
267
- }
268
-
269
- pub fn bopen ( & mut self ) {
270
- self . s . word ( "{" ) ;
271
- self . end ( ) ; // close the head-box
272
- }
273
-
274
244
pub fn bclose_maybe_open ( & mut self , span : rustc_span:: Span , close_box : bool ) {
275
245
self . maybe_print_comment ( span. hi ( ) ) ;
276
246
self . break_offset_if_not_bol ( 1 , -( INDENT_UNIT as isize ) ) ;
@@ -284,33 +254,6 @@ impl<'a> State<'a> {
284
254
self . bclose_maybe_open ( span, true )
285
255
}
286
256
287
- pub fn space_if_not_bol ( & mut self ) {
288
- if !self . s . is_beginning_of_line ( ) {
289
- self . s . space ( ) ;
290
- }
291
- }
292
-
293
- pub fn break_offset_if_not_bol ( & mut self , n : usize , off : isize ) {
294
- if !self . s . is_beginning_of_line ( ) {
295
- self . s . break_offset ( n, off)
296
- } else if off != 0 && self . s . last_token ( ) . is_hardbreak_tok ( ) {
297
- // We do something pretty sketchy here: tuck the nonzero
298
- // offset-adjustment we were going to deposit along with the
299
- // break into the previous hardbreak.
300
- self . s . replace_last_token ( pp:: Printer :: hardbreak_tok_offset ( off) ) ;
301
- }
302
- }
303
-
304
- // Synthesizes a comment that was not textually present in the original source
305
- // file.
306
- pub fn synth_comment ( & mut self , text : String ) {
307
- self . s . word ( "/*" ) ;
308
- self . s . space ( ) ;
309
- self . s . word ( text) ;
310
- self . s . space ( ) ;
311
- self . s . word ( "*/" )
312
- }
313
-
314
257
pub fn commasep_cmnt < T , F , G > ( & mut self , b : Breaks , elts : & [ T ] , mut op : F , mut get_span : G )
315
258
where
316
259
F : FnMut ( & mut State < ' _ > , & T ) ,
@@ -2408,29 +2351,6 @@ impl<'a> State<'a> {
2408
2351
self . end ( ) ;
2409
2352
}
2410
2353
2411
- pub fn maybe_print_trailing_comment (
2412
- & mut self ,
2413
- span : rustc_span:: Span ,
2414
- next_pos : Option < BytePos > ,
2415
- ) {
2416
- if let Some ( cmnts) = self . comments ( ) {
2417
- if let Some ( cmnt) = cmnts. trailing_comment ( span, next_pos) {
2418
- self . print_comment ( & cmnt) ;
2419
- }
2420
- }
2421
- }
2422
-
2423
- pub fn print_remaining_comments ( & mut self ) {
2424
- // If there aren't any remaining comments, then we need to manually
2425
- // make sure there is a line break at the end.
2426
- if self . next_comment ( ) . is_none ( ) {
2427
- self . s . hardbreak ( ) ;
2428
- }
2429
- while let Some ( ref cmnt) = self . next_comment ( ) {
2430
- self . print_comment ( cmnt)
2431
- }
2432
- }
2433
-
2434
2354
pub fn print_fn_header_info ( & mut self , header : hir:: FnHeader , vis : & hir:: Visibility < ' _ > ) {
2435
2355
self . s . word ( visibility_qualified ( vis, "" ) ) ;
2436
2356
0 commit comments