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