Skip to content

Commit

Permalink
fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxVerevkin committed Dec 29, 2024
1 parent 192688a commit 13fd97d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -51,9 +51,9 @@ impl FromStr for Color {
fn from_str(color: &str) -> Result<Self, Self::Err> {
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(|_| ())?,
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 13fd97d

Please sign in to comment.