@@ -448,13 +448,10 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
448
448
if args_assert_failed. len( ) >= 4 ;
449
449
if let ExprKind :: Call ( _, args) = args_assert_failed[ 3 ] . kind;
450
450
if !args. is_empty( ) ;
451
- if let ExprKind :: Match ( expr_match, _, _ ) = args[ 0 ] . kind;
452
- if let ExprKind :: Match ( tup_match, _, _) = expr_match. kind;
453
- if let ExprKind :: Tup ( tup_args_list) = tup_match. kind;
451
+ if let Some ( mut format_arg_expn) = FormatArgsExpn :: parse( & args[ 0 ] ) ;
454
452
then {
455
- for arg in tup_args_list {
456
- vec_arg. push( arg) ;
457
- }
453
+ vec_arg. push( format_arg_expn. format_string) ;
454
+ vec_arg. append( & mut format_arg_expn. value_args) ;
458
455
}
459
456
}
460
457
return Some ( vec_arg) ;
@@ -526,6 +523,8 @@ impl FormatExpn<'tcx> {
526
523
527
524
/// A parsed `format_args!` expansion
528
525
pub struct FormatArgsExpn < ' tcx > {
526
+ /// The fist argument, the fromat string, as an expr
527
+ pub format_string : & ' tcx Expr < ' tcx > ,
529
528
/// Span of the first argument, the format string
530
529
pub format_string_span : Span ,
531
530
/// Values passed after the format string
@@ -582,6 +581,7 @@ impl FormatArgsExpn<'tcx> {
582
581
if let ExprKind :: Array ( args) = arm. body. kind;
583
582
then {
584
583
Some ( FormatArgsExpn {
584
+ format_string: strs_ref,
585
585
format_string_span: strs_ref. span,
586
586
value_args,
587
587
format_string_parts,
0 commit comments