@@ -211,7 +211,7 @@ pub fn literal_to_string(lit: token::Lit) -> String {
211
211
}
212
212
213
213
fn visibility_qualified ( vis : & ast:: Visibility , s : & str ) -> String {
214
- format ! ( "{}{}" , State :: new ( ) . to_string( |s| s. print_visibility( vis) ) , s)
214
+ format ! ( "{}{}" , State :: to_string( |s| s. print_visibility( vis) ) , s)
215
215
}
216
216
217
217
impl std:: ops:: Deref for State < ' _ > {
@@ -793,55 +793,55 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
793
793
}
794
794
795
795
fn ty_to_string ( & self , ty : & ast:: Ty ) -> String {
796
- self . to_string ( |s| s. print_type ( ty) )
796
+ Self :: to_string ( |s| s. print_type ( ty) )
797
797
}
798
798
799
799
fn bounds_to_string ( & self , bounds : & [ ast:: GenericBound ] ) -> String {
800
- self . to_string ( |s| s. print_type_bounds ( "" , bounds) )
800
+ Self :: to_string ( |s| s. print_type_bounds ( "" , bounds) )
801
801
}
802
802
803
803
fn pat_to_string ( & self , pat : & ast:: Pat ) -> String {
804
- self . to_string ( |s| s. print_pat ( pat) )
804
+ Self :: to_string ( |s| s. print_pat ( pat) )
805
805
}
806
806
807
807
fn expr_to_string ( & self , e : & ast:: Expr ) -> String {
808
- self . to_string ( |s| s. print_expr ( e) )
808
+ Self :: to_string ( |s| s. print_expr ( e) )
809
809
}
810
810
811
811
fn tt_to_string ( & self , tt : & TokenTree ) -> String {
812
- self . to_string ( |s| s. print_tt ( tt, false ) )
812
+ Self :: to_string ( |s| s. print_tt ( tt, false ) )
813
813
}
814
814
815
815
fn tts_to_string ( & self , tokens : & TokenStream ) -> String {
816
- self . to_string ( |s| s. print_tts ( tokens, false ) )
816
+ Self :: to_string ( |s| s. print_tts ( tokens, false ) )
817
817
}
818
818
819
819
fn stmt_to_string ( & self , stmt : & ast:: Stmt ) -> String {
820
- self . to_string ( |s| s. print_stmt ( stmt) )
820
+ Self :: to_string ( |s| s. print_stmt ( stmt) )
821
821
}
822
822
823
823
fn item_to_string ( & self , i : & ast:: Item ) -> String {
824
- self . to_string ( |s| s. print_item ( i) )
824
+ Self :: to_string ( |s| s. print_item ( i) )
825
825
}
826
826
827
827
fn generic_params_to_string ( & self , generic_params : & [ ast:: GenericParam ] ) -> String {
828
- self . to_string ( |s| s. print_generic_params ( generic_params) )
828
+ Self :: to_string ( |s| s. print_generic_params ( generic_params) )
829
829
}
830
830
831
831
fn path_to_string ( & self , p : & ast:: Path ) -> String {
832
- self . to_string ( |s| s. print_path ( p, false , 0 ) )
832
+ Self :: to_string ( |s| s. print_path ( p, false , 0 ) )
833
833
}
834
834
835
835
fn path_segment_to_string ( & self , p : & ast:: PathSegment ) -> String {
836
- self . to_string ( |s| s. print_path_segment ( p, false ) )
836
+ Self :: to_string ( |s| s. print_path_segment ( p, false ) )
837
837
}
838
838
839
839
fn vis_to_string ( & self , v : & ast:: Visibility ) -> String {
840
- self . to_string ( |s| s. print_visibility ( v) )
840
+ Self :: to_string ( |s| s. print_visibility ( v) )
841
841
}
842
842
843
843
fn block_to_string ( & self , blk : & ast:: Block ) -> String {
844
- self . to_string ( |s| {
844
+ Self :: to_string ( |s| {
845
845
// Containing cbox, will be closed by `print_block` at `}`.
846
846
s. cbox ( INDENT_UNIT ) ;
847
847
// Head-ibox, will be closed by `print_block` after `{`.
@@ -851,22 +851,22 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
851
851
}
852
852
853
853
fn meta_list_item_to_string ( & self , li : & ast:: NestedMetaItem ) -> String {
854
- self . to_string ( |s| s. print_meta_list_item ( li) )
854
+ Self :: to_string ( |s| s. print_meta_list_item ( li) )
855
855
}
856
856
857
857
fn attr_item_to_string ( & self , ai : & ast:: AttrItem ) -> String {
858
- self . to_string ( |s| s. print_attr_item ( ai, ai. path . span ) )
858
+ Self :: to_string ( |s| s. print_attr_item ( ai, ai. path . span ) )
859
859
}
860
860
861
861
fn attribute_to_string ( & self , attr : & ast:: Attribute ) -> String {
862
- self . to_string ( |s| s. print_attribute ( attr) )
862
+ Self :: to_string ( |s| s. print_attribute ( attr) )
863
863
}
864
864
865
865
fn param_to_string ( & self , arg : & ast:: Param ) -> String {
866
- self . to_string ( |s| s. print_param ( arg, false ) )
866
+ Self :: to_string ( |s| s. print_param ( arg, false ) )
867
867
}
868
868
869
- fn to_string ( & self , f : impl FnOnce ( & mut State < ' _ > ) ) -> String {
869
+ fn to_string ( f : impl FnOnce ( & mut State < ' _ > ) ) -> String {
870
870
let mut printer = State :: new ( ) ;
871
871
f ( & mut printer) ;
872
872
printer. s . eof ( )
@@ -1202,7 +1202,7 @@ impl<'a> State<'a> {
1202
1202
) ;
1203
1203
}
1204
1204
ast:: ItemKind :: Mod ( unsafety, ref mod_kind) => {
1205
- self . head ( self . to_string ( |s| {
1205
+ self . head ( Self :: to_string ( |s| {
1206
1206
s. print_visibility ( & item. vis ) ;
1207
1207
s. print_unsafety ( unsafety) ;
1208
1208
s. word ( "mod" ) ;
@@ -1228,7 +1228,7 @@ impl<'a> State<'a> {
1228
1228
}
1229
1229
}
1230
1230
ast:: ItemKind :: ForeignMod ( ref nmod) => {
1231
- self . head ( self . to_string ( |s| {
1231
+ self . head ( Self :: to_string ( |s| {
1232
1232
s. print_unsafety ( nmod. unsafety ) ;
1233
1233
s. word ( "extern" ) ;
1234
1234
} ) ) ;
@@ -1450,7 +1450,7 @@ impl<'a> State<'a> {
1450
1450
ast:: CrateSugar :: JustCrate => self . word_nbsp ( "crate" ) ,
1451
1451
} ,
1452
1452
ast:: VisibilityKind :: Restricted { ref path, .. } => {
1453
- let path = self . to_string ( |s| s. print_path ( path, false , 0 ) ) ;
1453
+ let path = Self :: to_string ( |s| s. print_path ( path, false , 0 ) ) ;
1454
1454
if path == "self" || path == "super" {
1455
1455
self . word_nbsp ( format ! ( "pub({})" , path) )
1456
1456
} else {
0 commit comments