@@ -18,11 +18,11 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
1818        self . tcx 
1919    } 
2020
21-     fn  print_region ( self ,  _region :  ty:: Region < ' _ > )  -> Result < Self ,  PrintError >  { 
22-         Ok ( self ) 
21+     fn  print_region ( & mut   self ,  _region :  ty:: Region < ' _ > )  -> Result < ( ) ,  PrintError >  { 
22+         Ok ( ( ) ) 
2323    } 
2424
25-     fn  print_type ( mut  self ,  ty :  Ty < ' tcx > )  -> Result < Self ,  PrintError >  { 
25+     fn  print_type ( & mut  self ,  ty :  Ty < ' tcx > )  -> Result < ( ) ,  PrintError >  { 
2626        match  * ty. kind ( )  { 
2727            // Types without identity. 
2828            ty:: Bool 
@@ -43,7 +43,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
4343            // Placeholders (all printed as `_` to uniformize them). 
4444            ty:: Param ( _)  | ty:: Bound ( ..)  | ty:: Placeholder ( _)  | ty:: Infer ( _)  | ty:: Error ( _)  => { 
4545                write ! ( self ,  "_" ) ?; 
46-                 Ok ( self ) 
46+                 Ok ( ( ) ) 
4747            } 
4848
4949            // Types with identity (print the module path). 
@@ -60,74 +60,74 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
6060        } 
6161    } 
6262
63-     fn  print_const ( self ,  ct :  ty:: Const < ' tcx > )  -> Result < Self ,  PrintError >  { 
63+     fn  print_const ( & mut   self ,  ct :  ty:: Const < ' tcx > )  -> Result < ( ) ,  PrintError >  { 
6464        self . pretty_print_const ( ct,  false ) 
6565    } 
6666
6767    fn  print_dyn_existential ( 
68-         self , 
68+         & mut   self , 
6969        predicates :  & ' tcx  ty:: List < ty:: PolyExistentialPredicate < ' tcx > > , 
70-     )  -> Result < Self ,  PrintError >  { 
70+     )  -> Result < ( ) ,  PrintError >  { 
7171        self . pretty_print_dyn_existential ( predicates) 
7272    } 
7373
74-     fn  path_crate ( mut  self ,  cnum :  CrateNum )  -> Result < Self ,  PrintError >  { 
74+     fn  path_crate ( & mut  self ,  cnum :  CrateNum )  -> Result < ( ) ,  PrintError >  { 
7575        self . path . push_str ( self . tcx . crate_name ( cnum) . as_str ( ) ) ; 
76-         Ok ( self ) 
76+         Ok ( ( ) ) 
7777    } 
7878
7979    fn  path_qualified ( 
80-         self , 
80+         & mut   self , 
8181        self_ty :  Ty < ' tcx > , 
8282        trait_ref :  Option < ty:: TraitRef < ' tcx > > , 
83-     )  -> Result < Self ,  PrintError >  { 
83+     )  -> Result < ( ) ,  PrintError >  { 
8484        self . pretty_path_qualified ( self_ty,  trait_ref) 
8585    } 
8686
8787    fn  path_append_impl ( 
88-         self , 
89-         print_prefix :  impl  FnOnce ( Self )  -> Result < Self ,  PrintError > , 
88+         & mut   self , 
89+         print_prefix :  impl  FnOnce ( & mut   Self )  -> Result < ( ) ,  PrintError > , 
9090        _disambiguated_data :  & DisambiguatedDefPathData , 
9191        self_ty :  Ty < ' tcx > , 
9292        trait_ref :  Option < ty:: TraitRef < ' tcx > > , 
93-     )  -> Result < Self ,  PrintError >  { 
93+     )  -> Result < ( ) ,  PrintError >  { 
9494        self . pretty_path_append_impl ( 
95-             |mut   cx| { 
96-                 cx =  print_prefix ( cx) ?; 
95+             |cx| { 
96+                 print_prefix ( cx) ?; 
9797
9898                cx. path . push_str ( "::" ) ; 
9999
100-                 Ok ( cx ) 
100+                 Ok ( ( ) ) 
101101            } , 
102102            self_ty, 
103103            trait_ref, 
104104        ) 
105105    } 
106106
107107    fn  path_append ( 
108-         mut  self , 
109-         print_prefix :  impl  FnOnce ( Self )  -> Result < Self ,  PrintError > , 
108+         & mut  self , 
109+         print_prefix :  impl  FnOnce ( & mut   Self )  -> Result < ( ) ,  PrintError > , 
110110        disambiguated_data :  & DisambiguatedDefPathData , 
111-     )  -> Result < Self ,  PrintError >  { 
112-         self  =  print_prefix ( self ) ?; 
111+     )  -> Result < ( ) ,  PrintError >  { 
112+         print_prefix ( self ) ?; 
113113
114114        write ! ( self . path,  "::{}" ,  disambiguated_data. data) . unwrap ( ) ; 
115115
116-         Ok ( self ) 
116+         Ok ( ( ) ) 
117117    } 
118118
119119    fn  path_generic_args ( 
120-         mut  self , 
121-         print_prefix :  impl  FnOnce ( Self )  -> Result < Self ,  PrintError > , 
120+         & mut  self , 
121+         print_prefix :  impl  FnOnce ( & mut   Self )  -> Result < ( ) ,  PrintError > , 
122122        args :  & [ GenericArg < ' tcx > ] , 
123-     )  -> Result < Self ,  PrintError >  { 
124-         self  =  print_prefix ( self ) ?; 
123+     )  -> Result < ( ) ,  PrintError >  { 
124+         print_prefix ( self ) ?; 
125125        let  args =
126126            args. iter ( ) . cloned ( ) . filter ( |arg| !matches ! ( arg. unpack( ) ,  GenericArgKind :: Lifetime ( _) ) ) ; 
127127        if  args. clone ( ) . next ( ) . is_some ( )  { 
128128            self . generic_delimiters ( |cx| cx. comma_sep ( args) ) 
129129        }  else  { 
130-             Ok ( self ) 
130+             Ok ( ( ) ) 
131131        } 
132132    } 
133133} 
@@ -136,31 +136,31 @@ impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
136136    fn  should_print_region ( & self ,  _region :  ty:: Region < ' _ > )  -> bool  { 
137137        false 
138138    } 
139-     fn  comma_sep < T > ( mut  self ,  mut  elems :  impl  Iterator < Item  = T > )  -> Result < Self ,  PrintError > 
139+     fn  comma_sep < T > ( & mut  self ,  mut  elems :  impl  Iterator < Item  = T > )  -> Result < ( ) ,  PrintError > 
140140    where 
141141        T :  Print < ' tcx ,  Self > , 
142142    { 
143143        if  let  Some ( first)  = elems. next ( )  { 
144-             self  =  first. print ( self ) ?; 
144+             first. print ( self ) ?; 
145145            for  elem in  elems { 
146146                self . path . push_str ( ", " ) ; 
147-                 self  =  elem. print ( self ) ?; 
147+                 elem. print ( self ) ?; 
148148            } 
149149        } 
150-         Ok ( self ) 
150+         Ok ( ( ) ) 
151151    } 
152152
153153    fn  generic_delimiters ( 
154-         mut  self , 
155-         f :  impl  FnOnce ( Self )  -> Result < Self ,  PrintError > , 
156-     )  -> Result < Self ,  PrintError >  { 
154+         & mut  self , 
155+         f :  impl  FnOnce ( & mut   Self )  -> Result < ( ) ,  PrintError > , 
156+     )  -> Result < ( ) ,  PrintError >  { 
157157        write ! ( self ,  "<" ) ?; 
158158
159-         self  =  f ( self ) ?; 
159+         f ( self ) ?; 
160160
161161        write ! ( self ,  ">" ) ?; 
162162
163-         Ok ( self ) 
163+         Ok ( ( ) ) 
164164    } 
165165
166166    fn  should_print_verbose ( & self )  -> bool  { 
@@ -177,5 +177,7 @@ impl Write for AbsolutePathPrinter<'_> {
177177} 
178178
179179pub  fn  type_name < ' tcx > ( tcx :  TyCtxt < ' tcx > ,  ty :  Ty < ' tcx > )  -> String  { 
180-     AbsolutePathPrinter  {  tcx,  path :  String :: new ( )  } . print_type ( ty) . unwrap ( ) . path 
180+     let  mut  printer = AbsolutePathPrinter  {  tcx,  path :  String :: new ( )  } ; 
181+     printer. print_type ( ty) . unwrap ( ) ; 
182+     printer. path 
181183} 
0 commit comments