From 7d175f85c1905c08adf547dd37cc89c63039f480 Mon Sep 17 00:00:00 2001 From: EdJoPaTo Date: Fri, 14 Jun 2024 11:26:57 +0200 Subject: [PATCH] refactor(lint): fix new lint warnings (#1178) --- examples/demo/app.rs | 4 ++-- src/layout/rect.rs | 2 +- src/style/palette_conversion.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/demo/app.rs b/examples/demo/app.rs index 952372f8..4ee6fd88 100644 --- a/examples/demo/app.rs +++ b/examples/demo/app.rs @@ -122,8 +122,8 @@ pub struct TabsState<'a> { } impl<'a> TabsState<'a> { - pub fn new(titles: Vec<&'a str>) -> TabsState { - TabsState { titles, index: 0 } + pub fn new(titles: Vec<&'a str>) -> Self { + Self { titles, index: 0 } } pub fn next(&mut self) { self.index = (self.index + 1) % self.titles.len(); diff --git a/src/layout/rect.rs b/src/layout/rect.rs index 17b0a08d..cbe418a9 100644 --- a/src/layout/rect.rs +++ b/src/layout/rect.rs @@ -58,7 +58,7 @@ impl Rect { /// Creates a new `Rect`, with width and height limited to keep the area under max `u16`. If /// clipped, aspect ratio will be preserved. pub fn new(x: u16, y: u16, width: u16, height: u16) -> Self { - let max_area = u16::max_value(); + let max_area = u16::MAX; let (clipped_width, clipped_height) = if u32::from(width) * u32::from(height) > u32::from(max_area) { let aspect_ratio = f64::from(width) / f64::from(height); diff --git a/src/style/palette_conversion.rs b/src/style/palette_conversion.rs index c1a0b382..1d0bfafc 100644 --- a/src/style/palette_conversion.rs +++ b/src/style/palette_conversion.rs @@ -23,7 +23,7 @@ use super::Color; impl> From> for Color { fn from(color: Srgb) -> Self { let (red, green, blue) = color.into_format().into_components(); - Color::Rgb(red, green, blue) + Self::Rgb(red, green, blue) } } @@ -48,7 +48,7 @@ where { fn from(color: LinSrgb) -> Self { let srgb_color = Srgb::::from_linear(color); - Color::from(srgb_color) + Self::from(srgb_color) } }