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 <noreply@anthropic.com>
This commit is contained in:
mihai2mn
2026-01-24 18:05:19 +01:00
parent 17bbd8aabb
commit 8d6a668f9e
4 changed files with 13 additions and 9 deletions

View File

@@ -348,7 +348,8 @@ fn main() {
"a" => { "a" => {
println!("Auto-scan mode (0 to {})...", scan_len - 1); println!("Auto-scan mode (0 to {})...", scan_len - 1);
let delay = std::time::Duration::from_millis(10); 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); write_single_led(&proxy, anime_type, idx, brightness);
print!("\rIndex: {} / {} ", idx, scan_len - 1); print!("\rIndex: {} / {} ", idx, scan_len - 1);
io::stdout().flush().unwrap(); io::stdout().flush().unwrap();

View File

@@ -27,6 +27,12 @@ pub struct AnimatorState {
pub running: Arc<AtomicBool>, pub running: Arc<AtomicBool>,
} }
impl Default for AnimatorState {
fn default() -> Self {
Self::new()
}
}
impl AnimatorState { impl AnimatorState {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {

View File

@@ -167,16 +167,15 @@ pub fn init_tray(
}; };
// TODO: return an error to the UI // TODO: return an error to the UI
let tray; let tray = match tray_init.disable_dbus_name(true).spawn().await {
match tray_init.disable_dbus_name(true).spawn().await { Ok(t) => t,
Ok(t) => tray = t,
Err(e) => { Err(e) => {
log::error!( log::error!(
"Tray unable to be initialised: {e:?}. Do you have a system tray enabled?" "Tray unable to be initialised: {e:?}. Do you have a system tray enabled?"
); );
return; return;
} }
} };
info!("Tray started"); info!("Tray started");
ICONS.get_or_init(|| Icons { ICONS.get_or_init(|| Icons {

View File

@@ -216,10 +216,8 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
if let Err(e) = aura_inner.stop_animation().await { if let Err(e) = aura_inner.stop_animation().await {
error!("Failed to stop animation: {e}"); error!("Failed to stop animation: {e}");
} }
} else { } else if let Err(e) = aura_inner.start_animation(json).await {
if let Err(e) = aura_inner.start_animation(json).await { error!("Failed to start animation: {e}");
error!("Failed to start animation: {e}");
}
} }
}); });
}); });