mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
refactor: Remove extra layer of AnsiDisplay
This commit is contained in:
parent
1773884715
commit
6255229a9c
1 changed files with 1 additions and 13 deletions
|
@ -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>) {
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue