@@ -18,7 +18,7 @@ use super::Lift;
18
18
pub type PrintError = std:: fmt:: Error ;
19
19
20
20
pub trait Print < ' tcx , P > {
21
- fn print ( & self , cx : & mut P ) -> Result < ( ) , PrintError > ;
21
+ fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > ;
22
22
}
23
23
24
24
/// Interface for outputting user-facing "type-system entities"
@@ -148,7 +148,7 @@ pub trait Printer<'tcx>: Sized {
148
148
&& args. len ( ) > parent_args. len ( )
149
149
{
150
150
return self . path_generic_args (
151
- |cx| cx . print_def_path ( def_id, parent_args) ,
151
+ |p| p . print_def_path ( def_id, parent_args) ,
152
152
& args[ ..parent_args. len ( ) + 1 ] [ ..1 ] ,
153
153
) ;
154
154
} else {
@@ -170,7 +170,7 @@ pub trait Printer<'tcx>: Sized {
170
170
if !generics. is_own_empty ( ) && args. len ( ) >= generics. count ( ) {
171
171
let args = generics. own_args_no_defaults ( self . tcx ( ) , args) ;
172
172
return self . path_generic_args (
173
- |cx| cx . print_def_path ( def_id, parent_args) ,
173
+ |p| p . print_def_path ( def_id, parent_args) ,
174
174
args,
175
175
) ;
176
176
}
@@ -186,16 +186,16 @@ pub trait Printer<'tcx>: Sized {
186
186
}
187
187
188
188
self . path_append (
189
- |cx : & mut Self | {
189
+ |p : & mut Self | {
190
190
if trait_qualify_parent {
191
191
let trait_ref = ty:: TraitRef :: new (
192
- cx . tcx ( ) ,
192
+ p . tcx ( ) ,
193
193
parent_def_id,
194
194
parent_args. iter ( ) . copied ( ) ,
195
195
) ;
196
- cx . path_qualified ( trait_ref. self_ty ( ) , Some ( trait_ref) )
196
+ p . path_qualified ( trait_ref. self_ty ( ) , Some ( trait_ref) )
197
197
} else {
198
- cx . print_def_path ( parent_def_id, parent_args)
198
+ p . print_def_path ( parent_def_id, parent_args)
199
199
}
200
200
} ,
201
201
& key. disambiguated_data ,
@@ -237,7 +237,7 @@ pub trait Printer<'tcx>: Sized {
237
237
// trait-type, then fallback to a format that identifies
238
238
// the module more clearly.
239
239
self . path_append_impl (
240
- |cx| cx . print_def_path ( parent_def_id, & [ ] ) ,
240
+ |p| p . print_def_path ( parent_def_id, & [ ] ) ,
241
241
& key. disambiguated_data ,
242
242
self_ty,
243
243
impl_trait_ref,
@@ -312,26 +312,26 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
312
312
}
313
313
314
314
impl < ' tcx , P : Printer < ' tcx > > Print < ' tcx , P > for ty:: Region < ' tcx > {
315
- fn print ( & self , cx : & mut P ) -> Result < ( ) , PrintError > {
316
- cx . print_region ( * self )
315
+ fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > {
316
+ p . print_region ( * self )
317
317
}
318
318
}
319
319
320
320
impl < ' tcx , P : Printer < ' tcx > > Print < ' tcx , P > for Ty < ' tcx > {
321
- fn print ( & self , cx : & mut P ) -> Result < ( ) , PrintError > {
322
- cx . print_type ( * self )
321
+ fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > {
322
+ p . print_type ( * self )
323
323
}
324
324
}
325
325
326
326
impl < ' tcx , P : Printer < ' tcx > > Print < ' tcx , P > for & ' tcx ty:: List < ty:: PolyExistentialPredicate < ' tcx > > {
327
- fn print ( & self , cx : & mut P ) -> Result < ( ) , PrintError > {
328
- cx . print_dyn_existential ( self )
327
+ fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > {
328
+ p . print_dyn_existential ( self )
329
329
}
330
330
}
331
331
332
332
impl < ' tcx , P : Printer < ' tcx > > Print < ' tcx , P > for ty:: Const < ' tcx > {
333
- fn print ( & self , cx : & mut P ) -> Result < ( ) , PrintError > {
334
- cx . print_const ( * self )
333
+ fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > {
334
+ p . print_const ( * self )
335
335
}
336
336
}
337
337
@@ -351,9 +351,9 @@ where
351
351
{
352
352
fn print ( t : & T , fmt : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
353
353
ty:: tls:: with ( |tcx| {
354
- let mut cx = FmtPrinter :: new ( tcx, Namespace :: TypeNS ) ;
355
- tcx. lift ( * t) . expect ( "could not lift for printing" ) . print ( & mut cx ) ?;
356
- fmt. write_str ( & cx . into_buffer ( ) ) ?;
354
+ let mut p = FmtPrinter :: new ( tcx, Namespace :: TypeNS ) ;
355
+ tcx. lift ( * t) . expect ( "could not lift for printing" ) . print ( & mut p ) ?;
356
+ fmt. write_str ( & p . into_buffer ( ) ) ?;
357
357
Ok ( ( ) )
358
358
} )
359
359
}
0 commit comments