@@ -426,14 +426,14 @@ impl ExtraComments<'tcx> {
426
426
}
427
427
}
428
428
429
- fn use_verbose ( ty : & & TyS < ' tcx > ) -> bool {
429
+ fn use_verbose ( ty : & & TyS < ' tcx > , fn_def : bool ) -> bool {
430
430
match ty. kind ( ) {
431
431
ty:: Int ( _) | ty:: Uint ( _) | ty:: Bool | ty:: Char | ty:: Float ( _) => false ,
432
432
// Unit type
433
433
ty:: Tuple ( g_args) if g_args. is_empty ( ) => false ,
434
- ty:: Tuple ( g_args) => g_args. iter ( ) . any ( |g_arg| use_verbose ( & g_arg. expect_ty ( ) ) ) ,
435
- ty:: Array ( ty, _) => use_verbose ( ty) ,
436
- ty:: FnDef ( ..) => false ,
434
+ ty:: Tuple ( g_args) => g_args. iter ( ) . any ( |g_arg| use_verbose ( & g_arg. expect_ty ( ) , fn_def ) ) ,
435
+ ty:: Array ( ty, _) => use_verbose ( ty, fn_def ) ,
436
+ ty:: FnDef ( ..) => fn_def ,
437
437
_ => true ,
438
438
}
439
439
}
@@ -442,28 +442,20 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
442
442
fn visit_constant ( & mut self , constant : & Constant < ' tcx > , location : Location ) {
443
443
self . super_constant ( constant, location) ;
444
444
let Constant { span, user_ty, literal } = constant;
445
- match literal. ty ( ) . kind ( ) {
446
- ty:: Int ( _) | ty:: Uint ( _) | ty:: Bool | ty:: Char => { }
447
- // Unit type
448
- ty:: Tuple ( tys) if tys. is_empty ( ) => { }
449
- _ => {
450
- self . push ( "mir::Constant" ) ;
451
- self . push ( & format ! (
452
- "+ span: {}" ,
453
- self . tcx. sess. source_map( ) . span_to_embeddable_string( * span)
454
- ) ) ;
455
- if let Some ( user_ty) = user_ty {
456
- self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
457
- }
458
- match literal {
459
- ConstantKind :: Ty ( literal) => self . push ( & format ! ( "+ literal: {:?}" , literal) ) ,
460
- ConstantKind :: Val ( val, ty) => {
461
- // To keep the diffs small, we render this almost like we render ty::Const
462
- self . push ( & format ! (
463
- "+ literal: Const {{ ty: {}, val: Value({:?}) }}" ,
464
- ty, val
465
- ) )
466
- }
445
+ if use_verbose ( & literal. ty ( ) , true ) {
446
+ self . push ( "mir::Constant" ) ;
447
+ self . push ( & format ! (
448
+ "+ span: {}" ,
449
+ self . tcx. sess. source_map( ) . span_to_embeddable_string( * span)
450
+ ) ) ;
451
+ if let Some ( user_ty) = user_ty {
452
+ self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
453
+ }
454
+ match literal {
455
+ ConstantKind :: Ty ( literal) => self . push ( & format ! ( "+ literal: {:?}" , literal) ) ,
456
+ ConstantKind :: Val ( val, ty) => {
457
+ // To keep the diffs small, we render this almost like we render ty::Const
458
+ self . push ( & format ! ( "+ literal: Const {{ ty: {}, val: Value({:?}) }}" , ty, val) )
467
459
}
468
460
}
469
461
}
@@ -472,7 +464,7 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
472
464
fn visit_const ( & mut self , constant : & & ' tcx ty:: Const < ' tcx > , _: Location ) {
473
465
self . super_const ( constant) ;
474
466
let ty:: Const { ty, val, .. } = constant;
475
- if use_verbose ( ty) {
467
+ if use_verbose ( ty, false ) {
476
468
self . push ( "ty::Const" ) ;
477
469
self . push ( & format ! ( "+ ty: {:?}" , ty) ) ;
478
470
let val = match val {
0 commit comments