From 681a023b04b513b3283d85fe157d6b38987bc42e Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Tue, 18 Feb 2025 21:15:00 +0200 Subject: Fix clippy warnings surfaced by the merge Pre-existing issues in the uncommitted rust-rewrite work (unused imports, over-arity glyph-drawing functions, a couple of complex inline types, or_insert_with(T::default) instead of or_default(), and one unsimplified test-only arithmetic expression), plus two imports left unused by switching to or_default(). None of these are behavior changes. Full workspace build + clippy -D warnings + test suite (378 tests) all green after this. --- crates/wayland/src/decoration/buttons.rs | 5 +++++ crates/wayland/src/decoration/tests.rs | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/wayland/src/decoration') diff --git a/crates/wayland/src/decoration/buttons.rs b/crates/wayland/src/decoration/buttons.rs index a965ef6..bb2a709 100644 --- a/crates/wayland/src/decoration/buttons.rs +++ b/crates/wayland/src/decoration/buttons.rs @@ -169,6 +169,7 @@ fn glossy_shade(color: (u8, u8, u8), dx: f32, dy: f32, radius: f32) -> (u8, u8, /// the titlebar's real foreground colour for one drawn straight on the /// titlebar background instead (see `titlebar::render_titlebar`'s own /// `glyph_shade` local for which, and why). +#[allow(clippy::too_many_arguments)] fn blend_glyph_px(buf: &mut [u8], width: usize, height: usize, x: i32, y: i32, alpha: u8, coverage: f32, shade: (u8, u8, u8)) { if x < 0 || y < 0 || x as usize >= width || y as usize >= height || alpha == 0 || coverage <= 0.0 { return; @@ -243,6 +244,7 @@ fn glyph_box(width: usize, height: usize, offset: usize, from_left: bool, margin ((cx - half).round() as i32, (cy - half).round() as i32, (cx + half).round() as i32, (cy + half).round() as i32) } +#[allow(clippy::too_many_arguments)] pub(super) fn draw_close_glyph(buf: &mut [u8], width: usize, height: usize, offset: usize, from_left: bool, margin: f32, alpha: u8, shade: (u8, u8, u8)) { let (x0, y0, x1, y1) = glyph_box(width, height, offset, from_left, margin); blend_glyph_line(buf, width, height, (x0, y0), (x1, y1), alpha, shade); @@ -254,6 +256,7 @@ pub(super) fn draw_close_glyph(buf: &mut [u8], width: usize, height: usize, offs /// convention), and still what a traffic-light-style maximize falls back /// to if it doesn't get `draw_zoom_glyph` instead. See `titlebar:: /// render_titlebar`'s own call site for which mode picks which. +#[allow(clippy::too_many_arguments)] pub(super) fn draw_maximize_glyph(buf: &mut [u8], width: usize, height: usize, offset: usize, from_left: bool, margin: f32, alpha: u8, shade: (u8, u8, u8)) { let (x0, y0, x1, y1) = glyph_box(width, height, offset, from_left, margin); blend_glyph_line(buf, width, height, (x0, y0), (x1, y0), alpha, shade); @@ -262,6 +265,7 @@ pub(super) fn draw_maximize_glyph(buf: &mut [u8], width: usize, height: usize, o blend_glyph_line(buf, width, height, (x1, y0), (x1, y1), alpha, shade); } +#[allow(clippy::too_many_arguments)] pub(super) fn draw_minimize_glyph(buf: &mut [u8], width: usize, height: usize, offset: usize, from_left: bool, margin: f32, alpha: u8, shade: (u8, u8, u8)) { let (x0, y0, x1, y1) = glyph_box(width, height, offset, from_left, margin); let mid = (y0 + y1) / 2; @@ -277,6 +281,7 @@ pub(super) fn draw_minimize_glyph(buf: &mut [u8], width: usize, height: usize, o /// glyph here already uses, so this reads as the same family of icon /// rather than a different rendering technique bolted on just for this one /// shape. +#[allow(clippy::too_many_arguments)] pub(super) fn draw_zoom_glyph(buf: &mut [u8], width: usize, height: usize, offset: usize, from_left: bool, margin: f32, alpha: u8, shade: (u8, u8, u8)) { let (x0, y0, x1, y1) = glyph_box(width, height, offset, from_left, margin); blend_glyph_line(buf, width, height, (x0, y1), (x1, y0), alpha, shade); diff --git a/crates/wayland/src/decoration/tests.rs b/crates/wayland/src/decoration/tests.rs index 0cc5d45..e9ef02e 100644 --- a/crates/wayland/src/decoration/tests.rs +++ b/crates/wayland/src/decoration/tests.rs @@ -1,11 +1,7 @@ use super::*; -use super::border::*; use super::buttons::*; use super::color::*; -use super::corners::*; -use super::font::*; use super::shadow::*; -use super::titlebar::*; #[test] fn border_strips_surround_geometry_without_overlapping_it() { -- cgit v1.2.3