From bb25edf019d6caa9b9a63796d0f522c97162755a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sun, 26 Sep 2021 13:00:39 -0700 Subject: [PATCH] docs: fix doctests --- README.md | 12 +++++++----- src/handler.rs | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 168c5aa..6f0747e 100644 --- a/README.md +++ b/README.md @@ -371,7 +371,7 @@ use thiserror::Error; #[error("oops")] struct MyError { #[related] - Vec, + others: Vec, } ``` @@ -384,13 +384,15 @@ of falling back to your own custom handler. Usage is like so: ```rust -miette::set_hook(|_| { - MietteHandlerOpts::new() +miette::set_hook(Box::new(|_| { + Box::new(miette::MietteHandlerOpts::new() .terminal_links(true) .unicode(false) .context_lines(3) - .build() -}) + .build()) +})) + +# .unwrap() ``` See the docs for [MietteHandlerOptions] for more details on what you can customize! diff --git a/src/handler.rs b/src/handler.rs index 1e8818b..10e7bf6 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -16,13 +16,14 @@ Create a custom [MietteHandler] from options. ## Example ```no_run -miette::set_hook(|_| { - MietteHandlerOpts::new() +miette::set_hook(Box::new(|_| { + Box::new(miette::MietteHandlerOpts::new() .terminal_links(true) .unicode(false) .context_lines(3) - .build() -}) + .build()) +})) +# .unwrap(); ``` */ #[derive(Default, Debug, Clone)]