diff options
author | Marco Ieni <11428655+MarcoIeni@users.noreply.github.com> | 2020-11-07 19:48:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-07 13:48:02 -0500 |
commit | b14942527ac7f839f16523f7fe390fe922c20553 (patch) | |
tree | c1d8274be561327a64c576b6333655e03928c517 /src/style.rs | |
parent | 2ca4b956c3e845b51eed816c78e2fd63c1de779f (diff) |
remove some clippy warnings (#383)
* remove some clippy warnings
* revert comparison_chain clippy lint
Allow it locally
Diffstat (limited to 'src/style.rs')
-rw-r--r-- | src/style.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/style.rs b/src/style.rs index d25fc2f7..a15f3eab 100644 --- a/src/style.rs +++ b/src/style.rs @@ -96,10 +96,12 @@ impl Style { pub fn to_painted_string(&self) -> ansi_term::ANSIGenericString<str> { self.paint(self.to_string()) } +} - fn to_string(&self) -> String { +impl fmt::Display for Style { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.is_raw { - return "raw".to_string(); + return write!(f, "raw"); } let mut words = Vec::<String>::new(); if self.is_omitted { @@ -137,7 +139,8 @@ impl Style { if let Some(color) = self.ansi_term_style.background { words.push(color::color_to_string(color)) } - words.join(" ") + let style_str = words.join(" "); + write!(f, "{}", style_str) } } |