@@ -42,29 +42,25 @@ pub fn calc_result<'a>(
4242 . map ( |e| & * * e)
4343 . or_else ( || err. downcast_ref :: < & ' static str > ( ) . map ( |e| * e) ) ;
4444
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 ) {
4946 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
5752 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,
6359 found non-string value: `{:?}`
64- expected substring: `{:?}`"# , ( * * err ) . type_id ( ) , & * msg )
65- )
66- }
67- }
60+ expected substring: `{:?}`"# ,
61+ ( * * err ) . type_id ( ) ,
62+ msg
63+ ) )
6864 }
6965 }
7066 ( & ShouldPanic :: Yes , Ok ( ( ) ) ) => {
0 commit comments