Open piegamesde opened 3 years ago
Apparently there is another rather elegant way of going about this:
https://docs.rs/human-panic/1.0.3/src/human_panic/lib.rs.html#194-201
let message = match (
panic_info.payload().downcast_ref::<&str>(),
panic_info.payload().downcast_ref::<String>(),
) {
(Some(s), _) => Some(s.to_string()),
(_, Some(s)) => Some(s.to_string()),
(None, None) => None,
};
I'm too lazy to fork and PR right now, sorry ^^
I just think that
would be a bit more idiomatic than the current nested match blocks. I haven't tested the code, but I hope you get the idea