Fix documentation for std::panic::update_hook

* `set_hook` expects a boxed function
* Missing closing delimiter for the closure
This commit is contained in:
Ilaï Deutel 2025-11-01 23:46:35 -04:00
parent bd3ac03300
commit b9e127a830

View file

@ -215,10 +215,10 @@ pub fn take_hook() -> Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send> {
///
/// // Equivalent to
/// // let prev = panic::take_hook();
/// // panic::set_hook(move |info| {
/// // panic::set_hook(Box::new(move |info| {
/// // println!("...");
/// // prev(info);
/// // );
/// // }));
/// panic::update_hook(move |prev, info| {
/// println!("Print custom message and execute panic handler as usual");
/// prev(info);