diff --git a/src/chain.rs b/src/chain.rs index fe4d336..a71c476 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -10,7 +10,7 @@ use ChainState::*; #[derive(Clone)] #[allow(missing_debug_implementations)] -pub struct Chain<'a> { +pub(crate) struct Chain<'a> { state: crate::chain::ChainState<'a>, } @@ -25,7 +25,7 @@ pub(crate) enum ChainState<'a> { } impl<'a> Chain<'a> { - pub fn new(head: &'a (dyn StdError + 'static)) -> Self { + pub(crate) fn new(head: &'a (dyn StdError + 'static)) -> Self { Chain { state: ChainState::Linked { next: Some(head) }, } diff --git a/src/lib.rs b/src/lib.rs index aed062d..320da08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ #![doc = include_str!("../README.md")] -#![deny(missing_docs)] -// #![deny(missing_docs, missing_debug_implementations, nonstandard_style)] -// #![warn(unreachable_pub, rust_2018_idioms)] +#![deny(missing_docs, missing_debug_implementations, nonstandard_style)] +#![warn(unreachable_pub, rust_2018_idioms)] pub use miette_derive::*; diff --git a/src/printer/mod.rs b/src/printer/mod.rs index d3c50e7..cfd3d3f 100644 --- a/src/printer/mod.rs +++ b/src/printer/mod.rs @@ -9,8 +9,13 @@ use once_cell::sync::OnceCell; use crate::protocol::{Diagnostic, DiagnosticReportPrinter, Severity}; use crate::MietteError; +// NOTE(zkat): I don't understand why these three are "unreachable" when +// they're clearly being exported? Maybe a bug? +#[allow(unreachable_pub)] pub use graphical_printer::*; +#[allow(unreachable_pub)] pub use narratable_printer::*; +#[allow(unreachable_pub)] pub use theme::*; mod graphical_printer; @@ -54,6 +59,7 @@ fn get_default_printer() -> Box fmt::Result { + fn render_snippet(&self, f: &mut impl fmt::Write, snippet: &DiagnosticSnippet<'_>) -> fmt::Result { let (contents, lines) = self.get_lines(snippet)?; write!(f, "Begin snippet")?; @@ -127,7 +127,7 @@ impl NarratableReportPrinter { fn get_lines<'a>( &'a self, - snippet: &'a DiagnosticSnippet, + snippet: &'a DiagnosticSnippet<'a>, ) -> Result<(Box, Vec), fmt::Error> { let context_data = snippet .source diff --git a/src/protocol.rs b/src/protocol.rs index 7a33cf7..8681da6 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -40,7 +40,7 @@ pub trait Diagnostic: std::error::Error { /// Additional contextual snippets. This is typically used for adding /// marked-up source file output the way compilers often do. - fn snippets(&self) -> Option + '_>> { + fn snippets(&self) -> Option> + '_>> { None } }