@@ -10,7 +10,7 @@ use rustc_hir::{GenericArg, GenericParam, GenericParamKind, Node};
1010use rustc_hir:: { GenericBound , PatKind , RangeEnd , TraitBoundModifier } ;
1111use rustc_span:: source_map:: { SourceMap , Spanned } ;
1212use rustc_span:: symbol:: { kw, Ident , IdentPrinter , Symbol } ;
13- use rustc_span:: { self , BytePos , FileName } ;
13+ use rustc_span:: { self , FileName } ;
1414use rustc_target:: spec:: abi:: Abi ;
1515
1616use std:: borrow:: Cow ;
@@ -241,36 +241,6 @@ pub fn enum_def_to_string(
241241}
242242
243243impl < ' 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-
274244 pub fn bclose_maybe_open ( & mut self , span : rustc_span:: Span , close_box : bool ) {
275245 self . maybe_print_comment ( span. hi ( ) ) ;
276246 self . break_offset_if_not_bol ( 1 , -( INDENT_UNIT as isize ) ) ;
@@ -284,33 +254,6 @@ impl<'a> State<'a> {
284254 self . bclose_maybe_open ( span, true )
285255 }
286256
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-
314257 pub fn commasep_cmnt < T , F , G > ( & mut self , b : Breaks , elts : & [ T ] , mut op : F , mut get_span : G )
315258 where
316259 F : FnMut ( & mut State < ' _ > , & T ) ,
@@ -2408,29 +2351,6 @@ impl<'a> State<'a> {
24082351 self . end ( ) ;
24092352 }
24102353
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-
24342354 pub fn print_fn_header_info ( & mut self , header : hir:: FnHeader , vis : & hir:: Visibility < ' _ > ) {
24352355 self . s . word ( visibility_qualified ( vis, "" ) ) ;
24362356
0 commit comments