Fix cargo clippy warning and error (#877)

This commit is contained in:
ken 2024-05-04 01:23:50 +08:00 committed by GitHub
parent 39ef1e42ba
commit 2545954076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -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,
}

View File

@ -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)
}
}
}