From 89c9325457435bb15bfe4a77a5c66101dd4e163d Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Mon, 8 Aug 2022 09:51:24 +0100 Subject: [PATCH] Formatting --- src/handler.rs | 4 ++-- src/handlers/graphical.rs | 20 +++++++++++--------- src/handlers/narratable.rs | 7 ++++--- src/lib.rs | 17 ++++++++--------- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/handler.rs b/src/handler.rs index bd55ef2..b5f9993 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -56,7 +56,7 @@ pub struct MietteHandlerOpts { pub(crate) footer: Option, pub(crate) context_lines: Option, pub(crate) tab_width: Option, - pub(crate) with_cause_chain: Option + pub(crate) with_cause_chain: Option, } impl MietteHandlerOpts { @@ -87,7 +87,7 @@ impl MietteHandlerOpts { self.width = Some(width); self } - + /// Include the cause chain of the top-level error in the report. pub fn with_cause_chain(mut self) -> Self { self.with_cause_chain = Some(true); diff --git a/src/handlers/graphical.rs b/src/handlers/graphical.rs index f5e8a7f..0034a8b 100644 --- a/src/handlers/graphical.rs +++ b/src/handlers/graphical.rs @@ -28,7 +28,7 @@ pub struct GraphicalReportHandler { pub(crate) footer: Option, pub(crate) context_lines: usize, pub(crate) tab_width: Option, - pub(crate) with_cause_chain: bool + pub(crate) with_cause_chain: bool, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -49,7 +49,7 @@ impl GraphicalReportHandler { footer: None, context_lines: 1, tab_width: None, - with_cause_chain: true + with_cause_chain: true, } } @@ -62,7 +62,7 @@ impl GraphicalReportHandler { footer: None, context_lines: 1, tab_width: None, - with_cause_chain: true + with_cause_chain: true, } } @@ -81,14 +81,16 @@ impl GraphicalReportHandler { }; self } - - /// Include the cause chain of the top-level error in the graphical output, if available. + + /// Include the cause chain of the top-level error in the graphical output, + /// if available. pub fn with_cause_chain(mut self) -> Self { self.with_cause_chain = true; self } - - /// Do not include the cause chain of the top-level error in the graphical output. + + /// Do not include the cause chain of the top-level error in the graphical + /// output. pub fn without_cause_chain(mut self) -> Self { self.with_cause_chain = false; self @@ -215,9 +217,9 @@ impl GraphicalReportHandler { writeln!(f, "{}", textwrap::fill(&diagnostic.to_string(), opts))?; if !self.with_cause_chain { - return Ok(()) + return Ok(()); } - + if let Some(mut cause_iter) = diagnostic .diagnostic_source() .map(DiagnosticChain::from_diagnostic) diff --git a/src/handlers/narratable.rs b/src/handlers/narratable.rs index b2d6a39..5855752 100644 --- a/src/handlers/narratable.rs +++ b/src/handlers/narratable.rs @@ -25,11 +25,12 @@ impl NarratableReportHandler { Self { footer: None, context_lines: 1, - with_cause_chain: true + with_cause_chain: true, } } - - /// Include the cause chain of the top-level error in the report, if available. + + /// Include the cause chain of the top-level error in the report, if + /// available. pub fn with_cause_chain(mut self) -> Self { self.with_cause_chain = true; self diff --git a/src/lib.rs b/src/lib.rs index 27875fc..de09898 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -582,15 +582,14 @@ //! `miette` was not developed in a void. It owes enormous credit to various //! other projects and their authors: //! -//! - [`anyhow`](http://crates.io/crates/anyhow) and -//! [`color-eyre`](https://crates.io/crates/color-eyre): these two -//! enormously influential error handling libraries have pushed forward the -//! experience of application-level error handling and error reporting. -//! `miette`'s `Report` type is an attempt at a very very rough version of -//! their `Report` types. -//! - [`thiserror`](https://crates.io/crates/thiserror) for setting the -//! standard for library-level error definitions, and for being the -//! inspiration behind `miette`'s derive macro. +//! - [`anyhow`](http://crates.io/crates/anyhow) and [`color-eyre`](https://crates.io/crates/color-eyre): +//! these two enormously influential error handling libraries have pushed +//! forward the experience of application-level error handling and error +//! reporting. `miette`'s `Report` type is an attempt at a very very rough +//! version of their `Report` types. +//! - [`thiserror`](https://crates.io/crates/thiserror) for setting the standard +//! for library-level error definitions, and for being the inspiration behind +//! `miette`'s derive macro. //! - `rustc` and [@estebank](https://github.com/estebank) for their //! state-of-the-art work in compiler diagnostics. //! - [`ariadne`](https://crates.io/crates/ariadne) for pushing forward how