Skip to content

Commit d9f99c3

Browse files
author
Lukas Markeffsky
committed
Use Display in top-level example for PanicInfo
1 parent 709a97f commit d9f99c3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

library/core/src/panic/panic_info.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ use crate::panic::Location;
1515
/// use std::panic;
1616
///
1717
/// panic::set_hook(Box::new(|panic_info| {
18-
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
19-
/// println!("panic occurred: {s:?}");
20-
/// } else {
21-
/// println!("panic occurred");
22-
/// }
18+
/// println!("panic occurred: {panic_info}");
2319
/// }));
2420
///
25-
/// panic!("Normal panic");
21+
/// panic!("critical system failure");
2622
/// ```
2723
#[lang = "panic_info"]
2824
#[stable(feature = "panic_hooks", since = "1.10.0")]

0 commit comments

Comments
 (0)