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