File tree 1 file changed +7
-11
lines changed
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -70,17 +70,13 @@ fn test(do_panic: impl FnOnce(usize) -> !) {
70
70
do_panic_counter ( do_panic)
71
71
} ) ) . expect_err ( "do_panic() did not panic!" ) ;
72
72
73
- // See if we can extract panic message.
74
- match res. downcast :: < String > ( ) {
75
- Ok ( s) => {
76
- eprintln ! ( "Caught panic message (String): {}" , s) ;
77
- }
78
- Err ( res) =>
79
- if let Ok ( s) = res. downcast :: < & str > ( ) {
80
- eprintln ! ( "Caught panic message (&str): {}" , s) ;
81
- } else {
82
- eprintln ! ( "Failed get caught panic message." ) ;
83
- }
73
+ // See if we can extract the panic message.
74
+ if let Some ( s) = res. downcast_ref :: < String > ( ) {
75
+ eprintln ! ( "Caught panic message (String): {}" , s) ;
76
+ } else if let Some ( s) = res. downcast_ref :: < & str > ( ) {
77
+ eprintln ! ( "Caught panic message (&str): {}" , s) ;
78
+ } else {
79
+ eprintln ! ( "Failed get caught panic message." ) ;
84
80
}
85
81
86
82
// Test flags.
You can’t perform that action at this time.
0 commit comments