diff --git a/Cargo.lock b/Cargo.lock index 5f51c9b49..9d8fa443f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2106,6 +2106,21 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "overflow" +version = "0.1.0" +dependencies = [ + "jolt-sdk", + "overflow-guest", +] + +[[package]] +name = "overflow-guest" +version = "0.1.0" +dependencies = [ + "jolt-sdk", +] + [[package]] name = "overload" version = "0.1.1" diff --git a/examples/overflow/src/main.rs b/examples/overflow/src/main.rs index f244be0aa..fcad83eb3 100644 --- a/examples/overflow/src/main.rs +++ b/examples/overflow/src/main.rs @@ -32,11 +32,9 @@ pub fn main() { } fn handle_result(res: Result<(), Box>) { - match &res { - Err(e) => match e.downcast_ref::() { - Some(msg) => println!("> Panic occurred with message: {}\n", msg), - _ => (), - }, - _ => (), + if let Err(e) = &res { + if let Some(msg) = e.downcast_ref::() { + println!("--> Panic occurred with message: {}\n", msg); + } } }