Skip to content

Commit

Permalink
refactor: Remove extra layer of AnsiDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 16, 2023
1 parent 11583e1 commit c579c17
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/builder/styled_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl StyledStr {
/// Display using [ANSI Escape Code](https://en.wikipedia.org/wiki/ANSI_escape_code) styling
#[cfg(feature = "color")]
pub fn ansi(&self) -> impl std::fmt::Display + '_ {
AnsiDisplay { styled: self }
self.0.as_str()
}

pub(crate) fn header(&mut self, msg: impl Into<String>) {
Expand Down Expand Up @@ -210,18 +210,6 @@ impl std::fmt::Display for StyledStr {
}
}

#[cfg(feature = "color")]
struct AnsiDisplay<'s> {
styled: &'s StyledStr,
}

#[cfg(feature = "color")]
impl std::fmt::Display for AnsiDisplay<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.styled.0.fmt(f)
}
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub(crate) enum Style {
Header,
Expand Down

0 comments on commit c579c17

Please sign in to comment.