From 13fd97d22add77cfe80e7f6ec8b197304db872cb Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Sun, 29 Dec 2024 08:01:00 +0200 Subject: [PATCH] fix clippy lints --- src/color.rs | 16 ++++++++-------- src/config.rs | 2 +- src/key.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/color.rs b/src/color.rs index 53b2329..e0efe0d 100644 --- a/src/color.rs +++ b/src/color.rs @@ -37,10 +37,10 @@ impl Color { } pub fn from_rgba_hex(hex: u32) -> Self { - let r = (hex >> 24 & 0xFF) as u8; - let g = (hex >> 16 & 0xFF) as u8; - let b = (hex >> 8 & 0xFF) as u8; - let a = (hex & 0xFF) as u8; + let r = (hex >> 24) as u8; + let g = (hex >> 16) as u8; + let b = (hex >> 8) as u8; + let a = hex as u8; Self::from_rgba(r, g, b, a) } } @@ -51,9 +51,9 @@ impl FromStr for Color { fn from_str(color: &str) -> Result { let rgb = color.get(1..7).ok_or(())?; let rgb = u32::from_str_radix(rgb, 16).map_err(|_| ())?; - let r = (rgb >> 16 & 0xFF) as u8; - let g = (rgb >> 8 & 0xFF) as u8; - let b = (rgb & 0xFF) as u8; + let r = (rgb >> 16) as u8; + let g = (rgb >> 8) as u8; + let b = rgb as u8; let a = match color.get(7..9) { Some(a) => u8::from_str_radix(a, 16).map_err(|_| ())?, @@ -71,7 +71,7 @@ impl<'de> de::Deserialize<'de> for Color { { struct ColorVisitor; - impl<'de> de::Visitor<'de> for ColorVisitor { + impl de::Visitor<'_> for ColorVisitor { type Value = Color; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/config.rs b/src/config.rs index a70d53b..9ba0cec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -104,7 +104,7 @@ impl<'de> de::Deserialize<'de> for Font { { struct FontVisitor; - impl<'de> de::Visitor<'de> for FontVisitor { + impl de::Visitor<'_> for FontVisitor { type Value = Font; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/key.rs b/src/key.rs index df292c1..f0fe240 100644 --- a/src/key.rs +++ b/src/key.rs @@ -65,7 +65,7 @@ impl<'de> de::Deserialize<'de> for Key { { struct KeyVisitor; - impl<'de> de::Visitor<'de> for KeyVisitor { + impl de::Visitor<'_> for KeyVisitor { type Value = Key; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {