From 26a8924bc8752e6e56a08221c6bfe0fcee7c1d1f Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Fri, 29 Nov 2024 10:58:17 +0100 Subject: [PATCH] clippy++ --- src/buffers.rs | 4 ++-- src/geometry.rs | 4 ++-- src/mappings.rs | 18 +++++++++--------- src/power.rs | 2 +- src/render.rs | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/buffers.rs b/src/buffers.rs index 6d7b587..93ddf95 100644 --- a/src/buffers.rs +++ b/src/buffers.rs @@ -46,7 +46,7 @@ impl Default for BoundSurface>>{ impl Surface for BoundSurface>> { fn rect(&self) -> Rectangle { - self.binding.borrow().rect.clone() + self.binding.borrow().rect } fn with_shader(&self, mut f: F) { @@ -64,7 +64,7 @@ impl Surface for BoundSurface>> { } fn set_rect(&mut self, rect: &Rectangle) { - self.binding.borrow_mut().rect = rect.clone(); + self.binding.borrow_mut().rect = *rect; } fn opacity(&self) -> u8 { diff --git a/src/geometry.rs b/src/geometry.rs index 3382272..ef675ae 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -118,11 +118,11 @@ impl Rectangle { } pub fn width(&self) -> Space::Data { - self.bottom_right.x.clone() - self.top_left.x.clone() + self.bottom_right.x - self.top_left.x } pub fn height(&self) -> Space::Data { - self.bottom_right.y.clone() - self.top_left.y.clone() + self.bottom_right.y - self.top_left.y } pub const fn left(&self) -> Space::Data { diff --git a/src/mappings.rs b/src/mappings.rs index 0b61836..451cc9c 100644 --- a/src/mappings.rs +++ b/src/mappings.rs @@ -17,7 +17,7 @@ pub trait Select<'a> { } #[derive(Debug)] -struct LinearCoordView { +pub struct LinearCoordView { rect: Rectangle, idx: usize, } @@ -165,17 +165,17 @@ impl StrideMapping { physical_idx += length as usize; size = Some(match size.take() { None => Rectangle::new( - Coordinates::new(x.into(), y.into()), - Coordinates::new(x.into(), (y + length - 1).into()), + Coordinates::new(x, y), + Coordinates::new(x, (y + length - 1)), ), Some(s) => Rectangle::new( Coordinates::new( - min(s.top_left.x, x.into()), - min(s.top_left.y, y.into()) + min(s.top_left.x, x), + min(s.top_left.y, y) ), Coordinates::new( - max(s.bottom_right.x, x.into()), - max(s.bottom_right.y, (y + length - 1).into()) + max(s.bottom_right.x, x), + max(s.bottom_right.y, (y + length - 1)) ) ) }); @@ -260,7 +260,7 @@ impl<'a> StrideView<'a> { map, range, step_size, - cur: range.top_left.clone() + cur: range.top_left }; } } @@ -289,7 +289,7 @@ impl<'a> CoordinateView<'a> for StrideView<'a> { debug_assert!(self.cur.y <= cur_stride.y + cur_stride.length - 1, "coords={:?} out of bounds for stride={:?} view={:?}", self.cur, cur_stride, self); // Move to the next coord and return - let physical_coords = self.cur.clone(); + let physical_coords = self.cur; self.cur.y += 1; let virtual_coords = VirtualCoordinates::new( diff --git a/src/power.rs b/src/power.rs index 9b59679..84f5ac5 100644 --- a/src/power.rs +++ b/src/power.rs @@ -9,7 +9,7 @@ impl AsMilliwatts for RGB8 { const RED_MW : u32 = 16 * 5; //< 16mA @ 5v = 80mW const GREEN_MW : u32 = 11 * 5; //< 11mA @ 5v = 55mW const BLUE_MW : u32 = 15 * 5; //< 15mA @ 5v = 75mW - const DARK_MW : u32 = 1 * 5; //< 1mA @ 5v = 5mW + const DARK_MW : u32 = 5; //< 1mA @ 5v = 5mW let red = (self.r as u32 * RED_MW).wrapping_shr(8); let green = (self.g as u32 * GREEN_MW).wrapping_shr(8); diff --git a/src/render.rs b/src/render.rs index df2b565..2ecc4f5 100644 --- a/src/render.rs +++ b/src/render.rs @@ -65,7 +65,7 @@ impl, S: Surface> Renderer { display, fps: RealTimeRunningAverage::default(), fps_display: Periodically::new_every_n_seconds(5), - _sfc: PhantomData::default() + _sfc: PhantomData } } }