From 2545954076fc70fbafaa2c8b3f5fe13933869ff8 Mon Sep 17 00:00:00 2001 From: ken <41325712+rtczza@users.noreply.github.com> Date: Sat, 4 May 2024 01:23:50 +0800 Subject: [PATCH] Fix cargo clippy warning and error (#877) --- src/macros.rs | 2 +- src/style/types/color.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index 9261c423..c04d84da 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -149,7 +149,7 @@ mod tests { // Helper for execute tests to confirm flush #[derive(Default, Debug, Clone)] - pub(self) struct FakeWrite { + struct FakeWrite { buffer: String, flushed: bool, } diff --git a/src/style/types/color.rs b/src/style/types/color.rs index b73c8376..026dc7ef 100644 --- a/src/style/types/color.rs +++ b/src/style/types/color.rs @@ -244,20 +244,20 @@ impl serde::ser::Serialize for Color { _ => "", }; - if str == "" { + if str.is_empty() { match *self { Color::AnsiValue(value) => { - return serializer.serialize_str(&format!("ansi_({})", value)); + serializer.serialize_str(&format!("ansi_({})", value)) } Color::Rgb { r, g, b } => { - return serializer.serialize_str(&format!("rgb_({},{},{})", r, g, b)); + serializer.serialize_str(&format!("rgb_({},{},{})", r, g, b)) } _ => { - return Err(serde::ser::Error::custom("Could not serialize enum type")); + Err(serde::ser::Error::custom("Could not serialize enum type")) } } } else { - return serializer.serialize_str(str); + serializer.serialize_str(str) } } }