@@ -485,12 +485,28 @@ impl FormatArgsExpn<'tcx> {
485485 if let ExpnKind :: Macro ( _, name) = expr. span. ctxt( ) . outer_expn_data( ) . kind;
486486 let name = name. as_str( ) ;
487487 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 {
490506 // Arguments::new_v1
491- [ strs_ref, args ] => Some ( ( strs_ref, args , None ) ) ,
507+ [ strs_ref, _ ] => Some ( ( strs_ref, None ) ) ,
492508 // 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) ) ) ,
494510 _ => None ,
495511 } ;
496512 if let ExprKind :: AddrOf ( BorrowKind :: Ref , _, strs_arr) = strs_ref. kind;
@@ -506,17 +522,6 @@ impl FormatArgsExpn<'tcx> {
506522 None
507523 } )
508524 . 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;
520525 then {
521526 Some ( FormatArgsExpn {
522527 format_string_span: strs_ref. span,
0 commit comments