From 8d6a668f9ec5fcff1d0bc79bbf5965c751b548d3 Mon Sep 17 00:00:00 2001 From: mihai2mn Date: Sat, 24 Jan 2026 18:05:19 +0100 Subject: [PATCH] fix(ci): Resolve clippy warnings for CI pipeline - Add Default impl for AnimatorState (new_without_default) - Fix needless late initialization in tray.rs - Collapse else-if in setup_aura.rs - Fix mut_range_bound in anime-led-scan example Co-Authored-By: Claude Opus 4.5 --- asusctl/examples/anime-led-scan.rs | 3 ++- asusd/src/aura_laptop/animator.rs | 6 ++++++ rog-control-center/src/tray.rs | 7 +++---- rog-control-center/src/ui/setup_aura.rs | 6 ++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/asusctl/examples/anime-led-scan.rs b/asusctl/examples/anime-led-scan.rs index c4ff9b94..3af721b6 100644 --- a/asusctl/examples/anime-led-scan.rs +++ b/asusctl/examples/anime-led-scan.rs @@ -348,7 +348,8 @@ fn main() { "a" => { println!("Auto-scan mode (0 to {})...", scan_len - 1); let delay = std::time::Duration::from_millis(10); - for idx in current_index..scan_len { + let start_index = current_index; + for idx in start_index..scan_len { write_single_led(&proxy, anime_type, idx, brightness); print!("\rIndex: {} / {} ", idx, scan_len - 1); io::stdout().flush().unwrap(); diff --git a/asusd/src/aura_laptop/animator.rs b/asusd/src/aura_laptop/animator.rs index a2e51413..405ded1c 100644 --- a/asusd/src/aura_laptop/animator.rs +++ b/asusd/src/aura_laptop/animator.rs @@ -27,6 +27,12 @@ pub struct AnimatorState { pub running: Arc, } +impl Default for AnimatorState { + fn default() -> Self { + Self::new() + } +} + impl AnimatorState { pub fn new() -> Self { Self { diff --git a/rog-control-center/src/tray.rs b/rog-control-center/src/tray.rs index feab04fc..255bb0e6 100644 --- a/rog-control-center/src/tray.rs +++ b/rog-control-center/src/tray.rs @@ -167,16 +167,15 @@ pub fn init_tray( }; // TODO: return an error to the UI - let tray; - match tray_init.disable_dbus_name(true).spawn().await { - Ok(t) => tray = t, + let tray = match tray_init.disable_dbus_name(true).spawn().await { + Ok(t) => t, Err(e) => { log::error!( "Tray unable to be initialised: {e:?}. Do you have a system tray enabled?" ); return; } - } + }; info!("Tray started"); ICONS.get_or_init(|| Icons { diff --git a/rog-control-center/src/ui/setup_aura.rs b/rog-control-center/src/ui/setup_aura.rs index 1e1466e3..6f685b39 100644 --- a/rog-control-center/src/ui/setup_aura.rs +++ b/rog-control-center/src/ui/setup_aura.rs @@ -216,10 +216,8 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc>) { if let Err(e) = aura_inner.stop_animation().await { error!("Failed to stop animation: {e}"); } - } else { - if let Err(e) = aura_inner.start_animation(json).await { - error!("Failed to start animation: {e}"); - } + } else if let Err(e) = aura_inner.start_animation(json).await { + error!("Failed to start animation: {e}"); } }); });