Use write! instead of Display::fmt
Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
This commit is contained in:
parent
00bff4d06d
commit
283de86708
2 changed files with 7 additions and 9 deletions
|
|
@ -32,13 +32,11 @@ impl Display for ColorType {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Grayscale { .. } => Display::fmt("Grayscale", f),
|
Self::Grayscale { .. } => write!(f, "Grayscale"),
|
||||||
Self::RGB { .. } => Display::fmt("RGB", f),
|
Self::RGB { .. } => write!(f, "RGB"),
|
||||||
Self::Indexed { palette } => {
|
Self::Indexed { palette } => write!(f, "Indexed ({} colors)", palette.len()),
|
||||||
Display::fmt(&format!("Indexed ({} colors)", palette.len()), f)
|
Self::GrayscaleAlpha => write!(f, "Grayscale + Alpha"),
|
||||||
}
|
Self::RGBA => write!(f, "RGB + Alpha"),
|
||||||
Self::GrayscaleAlpha => Display::fmt("Grayscale + Alpha", f),
|
|
||||||
Self::RGBA => Display::fmt("RGB + Alpha", f),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ impl Display for Deflaters {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Libdeflater { compression } => Display::fmt(&format!("zc = {}", compression), f),
|
Self::Libdeflater { compression } => write!(f, "zc = {compression}"),
|
||||||
#[cfg(feature = "zopfli")]
|
#[cfg(feature = "zopfli")]
|
||||||
Self::Zopfli { iterations } => Display::fmt(&format!("zopfli, zi = {}", iterations), f),
|
Self::Zopfli { iterations } => write!(f, "zopfli, zi = {iterations}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue