diff --git a/Cargo.toml b/Cargo.toml index 31ca80d..36be427 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ syn = { version = "1.0", features = ["full"] } [features] default = [] -fancy = [ +fancy-no-backtrace = [ "owo-colors", "atty", "textwrap", @@ -46,6 +46,9 @@ fancy = [ "supports-hyperlinks", "supports-color", "supports-unicode", +] +fancy = [ + "fancy-no-backtrace", "backtrace", ] diff --git a/src/eyreish/mod.rs b/src/eyreish/mod.rs index 386daba..e7ada1d 100644 --- a/src/eyreish/mod.rs +++ b/src/eyreish/mod.rs @@ -26,10 +26,10 @@ pub use ReportHandler as EyreContext; #[allow(unreachable_pub)] pub use WrapErr as Context; -#[cfg(not(feature = "fancy"))] +#[cfg(not(feature = "fancy-no-backtrace"))] use crate::DebugReportHandler; use crate::Diagnostic; -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] use crate::MietteHandler; use error::ErrorImpl; @@ -98,9 +98,9 @@ fn capture_handler(error: &(dyn Diagnostic + 'static)) -> Box } fn get_default_printer(_err: &(dyn Diagnostic + 'static)) -> Box { - #[cfg(feature = "fancy")] + #[cfg(feature = "fancy-no-backtrace")] return Box::new(MietteHandler::new()); - #[cfg(not(feature = "fancy"))] + #[cfg(not(feature = "fancy-no-backtrace"))] return Box::new(DebugReportHandler::new()); } diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 5df8e73..fde2dc9 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -5,20 +5,20 @@ Reporters included with `miette`. #[allow(unreachable_pub)] pub use debug::*; #[allow(unreachable_pub)] -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] pub use graphical::*; #[allow(unreachable_pub)] pub use json::*; #[allow(unreachable_pub)] pub use narratable::*; #[allow(unreachable_pub)] -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] pub use theme::*; mod debug; -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] mod graphical; mod json; mod narratable; -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] mod theme; diff --git a/src/lib.rs b/src/lib.rs index bb1cc6c..d52a8f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -531,7 +531,7 @@ pub use miette_derive::*; pub use error::*; pub use eyreish::*; -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] pub use handler::*; pub use handlers::*; pub use named_source::*; @@ -542,7 +542,7 @@ pub use protocol::*; mod chain; mod error; mod eyreish; -#[cfg(feature = "fancy")] +#[cfg(feature = "fancy-no-backtrace")] mod handler; mod handlers; mod named_source; diff --git a/tests/graphical.rs b/tests/graphical.rs index 0cd38b8..394a873 100644 --- a/tests/graphical.rs +++ b/tests/graphical.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "fancy")] +#![cfg(feature = "fancy-no-backtrace")] use miette::{ Diagnostic, GraphicalReportHandler, GraphicalTheme, MietteError, NamedSource, diff --git a/tests/narrated.rs b/tests/narrated.rs index 038a806..c1656c3 100644 --- a/tests/narrated.rs +++ b/tests/narrated.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "fancy")] +#![cfg(feature = "fancy-no-backtrace")] use miette::{Diagnostic, MietteError, NamedSource, NarratableReportHandler, Report, SourceSpan}; @@ -9,8 +9,8 @@ use thiserror::Error; fn fmt_report(diag: Report) -> String { let mut out = String::new(); // Mostly for dev purposes. - if cfg!(feature = "fancy") && std::env::var("STYLE").is_ok() { - #[cfg(feature = "fancy")] + if cfg!(feature = "fancy-no-backtrace") && std::env::var("STYLE").is_ok() { + #[cfg(feature = "fancy-no-backtrace")] GraphicalReportHandler::new_themed(GraphicalTheme::unicode()) .render_report(&mut out, diag.as_ref()) .unwrap();