Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color_eyre): build warnings #182

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions color-eyre/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,6 @@ use std::env;
use std::fmt::Write as _;
use std::{fmt, path::PathBuf, sync::Arc};

#[derive(Debug)]
struct InstallError;

impl fmt::Display for InstallError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("could not install the BacktracePrinter as another was already installed")
}
}

impl std::error::Error for InstallError {}

#[derive(Debug)]
struct InstallThemeError;

impl fmt::Display for InstallThemeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("could not set the provided `Theme` globally as another was already set")
}
}

impl std::error::Error for InstallThemeError {}

#[derive(Debug)]
struct InstallColorSpantraceThemeError;

impl fmt::Display for InstallColorSpantraceThemeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")
}
}

impl std::error::Error for InstallColorSpantraceThemeError {}

/// A struct that represents a theme that is used by `color_eyre`
#[derive(Debug, Copy, Clone, Default)]
pub struct Theme {
Expand Down
8 changes: 8 additions & 0 deletions color-eyre/src/writers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ impl<W> WriterExt for W {
}
}

#[cfg(feature = "issue-url")]
pub(crate) trait DisplayExt: Sized + Display {
fn with_header<H: Display>(self, header: H) -> Header<Self, H>;
fn with_footer<F: Display>(self, footer: F) -> Footer<Self, F>;
}

#[cfg(feature = "issue-url")]
impl<T> DisplayExt for T
where
T: Display,
Expand Down Expand Up @@ -80,11 +82,13 @@ where
}
}

#[cfg(feature = "issue-url")]
pub(crate) struct FooterWriter<W> {
inner: W,
had_output: bool,
}

#[cfg(feature = "issue-url")]
impl<W> fmt::Write for FooterWriter<W>
where
W: fmt::Write,
Expand All @@ -98,6 +102,7 @@ where
}
}

#[cfg(feature = "issue-url")]
#[allow(explicit_outlives_requirements)]
pub(crate) struct Footer<B, H>
where
Expand All @@ -108,6 +113,7 @@ where
footer: H,
}

#[cfg(feature = "issue-url")]
impl<B, H> fmt::Display for Footer<B, H>
where
B: Display,
Expand All @@ -129,6 +135,7 @@ where
}
}

#[cfg(feature = "issue-url")]
#[allow(explicit_outlives_requirements)]
pub(crate) struct Header<B, H>
where
Expand All @@ -139,6 +146,7 @@ where
h: H,
}

#[cfg(feature = "issue-url")]
impl<B, H> fmt::Display for Header<B, H>
where
B: Display,
Expand Down
Loading