@@ -485,12 +485,28 @@ impl FormatArgsExpn<'tcx> {
485
485
if let ExpnKind :: Macro ( _, name) = expr. span. ctxt( ) . outer_expn_data( ) . kind;
486
486
let name = name. as_str( ) ;
487
487
if name. ends_with( "format_args" ) || name. ends_with( "format_args_nl" ) ;
488
- if let ExprKind :: Call ( _, args) = expr. kind;
489
- if let Some ( ( strs_ref, args, fmt_expr) ) = match args {
488
+
489
+ if let ExprKind :: Match ( inner_match, [ arm] , _) = expr. kind;
490
+
491
+ // `match match`, if you will
492
+ if let ExprKind :: Match ( args, [ inner_arm] , _) = inner_match. kind;
493
+ if let ExprKind :: Tup ( value_args) = args. kind;
494
+ if let Some ( value_args) = value_args
495
+ . iter( )
496
+ . map( |e| match e. kind {
497
+ ExprKind :: AddrOf ( _, _, e) => Some ( e) ,
498
+ _ => None ,
499
+ } )
500
+ . collect( ) ;
501
+ if let ExprKind :: Array ( args) = inner_arm. body. kind;
502
+
503
+ if let ExprKind :: Block ( Block { stmts: [ ] , expr: Some ( expr) , .. } , _) = arm. body. kind;
504
+ if let ExprKind :: Call ( _, call_args) = expr. kind;
505
+ if let Some ( ( strs_ref, fmt_expr) ) = match call_args {
490
506
// Arguments::new_v1
491
- [ strs_ref, args ] => Some ( ( strs_ref, args , None ) ) ,
507
+ [ strs_ref, _ ] => Some ( ( strs_ref, None ) ) ,
492
508
// Arguments::new_v1_formatted
493
- [ strs_ref, args , fmt_expr] => Some ( ( strs_ref, args , Some ( fmt_expr) ) ) ,
509
+ [ strs_ref, _ , fmt_expr] => Some ( ( strs_ref, Some ( fmt_expr) ) ) ,
494
510
_ => None ,
495
511
} ;
496
512
if let ExprKind :: AddrOf ( BorrowKind :: Ref , _, strs_arr) = strs_ref. kind;
@@ -506,17 +522,6 @@ impl FormatArgsExpn<'tcx> {
506
522
None
507
523
} )
508
524
. collect( ) ;
509
- if let ExprKind :: AddrOf ( BorrowKind :: Ref , _, args) = args. kind;
510
- if let ExprKind :: Match ( args, [ arm] , _) = args. kind;
511
- if let ExprKind :: Tup ( value_args) = args. kind;
512
- if let Some ( value_args) = value_args
513
- . iter( )
514
- . map( |e| match e. kind {
515
- ExprKind :: AddrOf ( _, _, e) => Some ( e) ,
516
- _ => None ,
517
- } )
518
- . collect( ) ;
519
- if let ExprKind :: Array ( args) = arm. body. kind;
520
525
then {
521
526
Some ( FormatArgsExpn {
522
527
format_string_span: strs_ref. span,
0 commit comments