@@ -42,29 +42,25 @@ pub fn calc_result<'a>(
42
42
. map ( |e| & * * e)
43
43
. or_else ( || err. downcast_ref :: < & ' static str > ( ) . map ( |e| * e) ) ;
44
44
45
- if maybe_panic_str
46
- . map ( |e| e. contains ( msg) )
47
- . unwrap_or ( false )
48
- {
45
+ if maybe_panic_str. map ( |e| e. contains ( msg) ) . unwrap_or ( false ) {
49
46
TestResult :: TrOk
50
- } else {
51
- if desc. allow_fail {
52
- TestResult :: TrAllowedFail
53
- } else {
54
- if let Some ( panic_str) = maybe_panic_str{
55
- TestResult :: TrFailedMsg (
56
- format ! ( r#"panic did not contain expected string
47
+ } else if desc. allow_fail {
48
+ TestResult :: TrAllowedFail
49
+ } else if let Some ( panic_str) = maybe_panic_str {
50
+ TestResult :: TrFailedMsg ( format ! (
51
+ r#"panic did not contain expected string
57
52
panic message: `{:?}`,
58
- expected substring: `{:?}`"# , panic_str, & * msg)
59
- )
60
- } else {
61
- TestResult :: TrFailedMsg (
62
- format ! ( r#"expected panic with string value,
53
+ expected substring: `{:?}`"# ,
54
+ panic_str, msg
55
+ ) )
56
+ } else {
57
+ TestResult :: TrFailedMsg ( format ! (
58
+ r#"expected panic with string value,
63
59
found non-string value: `{:?}`
64
- expected substring: `{:?}`"# , ( * * err ) . type_id ( ) , & * msg )
65
- )
66
- }
67
- }
60
+ expected substring: `{:?}`"# ,
61
+ ( * * err ) . type_id ( ) ,
62
+ msg
63
+ ) )
68
64
}
69
65
}
70
66
( & ShouldPanic :: Yes , Ok ( ( ) ) ) => {
0 commit comments