Skip to content

Commit

Permalink
refactor: make fancy-no-syscall the base feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Feb 22, 2024
1 parent 8f2db83 commit 08bb4af
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ fancy-no-syscall = [
"textwrap",
]
fancy-no-backtrace = [
"owo-colors",
"textwrap",
"fancy-no-syscall",
"terminal_size",
"supports-hyperlinks",
"supports-color",
Expand Down
8 changes: 4 additions & 4 deletions src/eyreish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ pub use ReportHandler as EyreContext;
#[allow(unreachable_pub)]
pub use WrapErr as Context;

#[cfg(not(feature = "fancy-no-backtrace"))]
#[cfg(not(feature = "fancy-no-syscall"))]
use crate::DebugReportHandler;
use crate::Diagnostic;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
use crate::MietteHandler;

use error::ErrorImpl;
Expand Down Expand Up @@ -102,9 +102,9 @@ fn capture_handler(error: &(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler>
}

fn get_default_printer(_err: &(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler + 'static> {
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
return Box::new(MietteHandler::new());
#[cfg(not(feature = "fancy-no-backtrace"))]
#[cfg(not(feature = "fancy-no-syscall"))]
return Box::new(DebugReportHandler::new());
}

Expand Down
8 changes: 4 additions & 4 deletions src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ Reporters included with `miette`.
#[allow(unreachable_pub)]
pub use debug::*;
#[allow(unreachable_pub)]
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
pub use graphical::*;
#[allow(unreachable_pub)]
pub use json::*;
#[allow(unreachable_pub)]
pub use narratable::*;
#[allow(unreachable_pub)]
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
pub use theme::*;

mod debug;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
mod graphical;
mod json;
mod narratable;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
mod theme;
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ pub use miette_derive::*;

pub use error::*;
pub use eyreish::*;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
pub use handler::*;
pub use handlers::*;
pub use miette_diagnostic::*;
Expand All @@ -773,10 +773,10 @@ mod chain;
mod diagnostic_chain;
mod error;
mod eyreish;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
mod handler;
mod handlers;
#[cfg(feature = "fancy-no-backtrace")]
#[cfg(feature = "fancy-no-syscall")]
pub mod highlighters;
#[doc(hidden)]
pub mod macro_helpers;
Expand Down

0 comments on commit 08bb4af

Please sign in to comment.