@@ -211,7 +211,7 @@ pub fn literal_to_string(lit: token::Lit) -> String {
211211}
212212
213213fn 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)
215215}
216216
217217impl std:: ops:: Deref for State < ' _ > {
@@ -792,55 +792,55 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
792792 }
793793
794794 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) )
796796 }
797797
798798 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) )
800800 }
801801
802802 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) )
804804 }
805805
806806 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) )
808808 }
809809
810810 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 ) )
812812 }
813813
814814 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 ) )
816816 }
817817
818818 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) )
820820 }
821821
822822 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) )
824824 }
825825
826826 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) )
828828 }
829829
830830 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 ) )
832832 }
833833
834834 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 ) )
836836 }
837837
838838 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) )
840840 }
841841
842842 fn block_to_string ( & self , blk : & ast:: Block ) -> String {
843- self . to_string ( |s| {
843+ Self :: to_string ( |s| {
844844 // Containing cbox, will be closed by `print_block` at `}`.
845845 s. cbox ( INDENT_UNIT ) ;
846846 // 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
850850 }
851851
852852 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) )
854854 }
855855
856856 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 ) )
858858 }
859859
860860 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) )
862862 }
863863
864864 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 ) )
866866 }
867867
868- fn to_string ( & self , f : impl FnOnce ( & mut State < ' _ > ) ) -> String {
868+ fn to_string ( f : impl FnOnce ( & mut State < ' _ > ) ) -> String {
869869 let mut printer = State :: new ( ) ;
870870 f ( & mut printer) ;
871871 printer. s . eof ( )
@@ -1199,7 +1199,7 @@ impl<'a> State<'a> {
11991199 ) ;
12001200 }
12011201 ast:: ItemKind :: Mod ( unsafety, ref mod_kind) => {
1202- self . head ( self . to_string ( |s| {
1202+ self . head ( Self :: to_string ( |s| {
12031203 s. print_visibility ( & item. vis ) ;
12041204 s. print_unsafety ( unsafety) ;
12051205 s. word ( "mod" ) ;
@@ -1225,7 +1225,7 @@ impl<'a> State<'a> {
12251225 }
12261226 }
12271227 ast:: ItemKind :: ForeignMod ( ref nmod) => {
1228- self . head ( self . to_string ( |s| {
1228+ self . head ( Self :: to_string ( |s| {
12291229 s. print_unsafety ( nmod. unsafety ) ;
12301230 s. word ( "extern" ) ;
12311231 } ) ) ;
@@ -1444,7 +1444,7 @@ impl<'a> State<'a> {
14441444 ast:: CrateSugar :: JustCrate => self . word_nbsp ( "crate" ) ,
14451445 } ,
14461446 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 ) ) ;
14481448 if path == "self" || path == "super" {
14491449 self . word_nbsp ( format ! ( "pub({})" , path) )
14501450 } else {
0 commit comments