From 47f570d5aefc19163e54575c81770c531610e977 Mon Sep 17 00:00:00 2001 From: xqqmdy Date: Fri, 30 Oct 2026 18:57:29 +0800 Subject: [PATCH 1/2] chore: drop redundant references in write! args clippy 1.99 (useless_borrows_in_formatting) denies these under -D warnings; local pre-push CI runs clippy with a newer toolchain than the one that last touched src/ui.rs, so the hook fails on main without this. --- src/ui.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index 85df93e..791b65b 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -200,7 +200,7 @@ impl Theme for ConfirmTheme { write!( f, "{} {} ", - &self.base.prompt_prefix, + self.base.prompt_prefix, self.base.prompt_style.apply_to(prompt) )?; } @@ -220,7 +220,7 @@ impl Theme for ConfirmTheme { brackets.apply_to("/"), no, brackets.apply_to("]"), - &self.base.prompt_suffix + self.base.prompt_suffix ), Some(true) => write!( f, @@ -230,7 +230,7 @@ impl Theme for ConfirmTheme { brackets.apply_to("/"), no, brackets.apply_to("]"), - &self.base.prompt_suffix, + self.base.prompt_suffix, self.base.defaults_style.apply_to("yes") ), Some(false) => write!( @@ -241,7 +241,7 @@ impl Theme for ConfirmTheme { brackets.apply_to("/"), no_default, brackets.apply_to("]"), - &self.base.prompt_suffix, + self.base.prompt_suffix, self.base.defaults_style.apply_to("no") ), } From 483ad5846cc85d95877927744128087a29c081e5 Mon Sep 17 00:00:00 2001 From: Jonatan Jonasson Date: Fri, 13 Nov 2026 12:29:54 +0100 Subject: [PATCH 2/2] chore: iterate bar heights directly in the OSD renderer --- src/bin/whispers-osd.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/whispers-osd.rs b/src/bin/whispers-osd.rs index cd66dc2..4b41090 100644 --- a/src/bin/whispers-osd.rs +++ b/src/bin/whispers-osd.rs @@ -126,7 +126,7 @@ impl BarState { let rms_target = (rms * 4.0).min(1.0); self.smooth_rms = self.smooth_rms * 0.85 + rms_target * 0.15; - for i in 0..NUM_BARS { + for (i, height) in self.heights.iter_mut().enumerate() { let t = i as f32 / NUM_BARS as f32; let wave1 = (t * std::f32::consts::PI * 2.0 + time * 2.0).sin() * 0.5 + 0.5; let wave2 = (t * std::f32::consts::PI * 1.5 - time * 1.2).sin() * 0.3 + 0.5; @@ -135,12 +135,12 @@ impl BarState { let combined = (wave1 * 0.55 + wave2 * 0.30 + wave3 * 0.15) * level; let target = BAR_MIN_HEIGHT + combined * (BAR_MAX_HEIGHT - BAR_MIN_HEIGHT); - if target > self.heights[i] { - self.heights[i] += (target - self.heights[i]) * RISE_RATE; + if target > *height { + *height += (target - *height) * RISE_RATE; } else { - self.heights[i] = self.heights[i] * DECAY_RATE + target * (1.0 - DECAY_RATE); + *height = *height * DECAY_RATE + target * (1.0 - DECAY_RATE); } - self.heights[i] = self.heights[i].clamp(BAR_MIN_HEIGHT, BAR_MAX_HEIGHT); + *height = height.clamp(BAR_MIN_HEIGHT, BAR_MAX_HEIGHT); } } } @@ -768,9 +768,9 @@ fn render_meter_bars( let glow_expand = 1 + (color_t * 2.0) as u32; let glow_alpha = (15.0 + color_t * 25.0) as u8; - for i in 0..NUM_BARS { + for (i, &height) in bars.heights.iter().enumerate() { let bx = start_x + i as u32 * (BAR_WIDTH + BAR_GAP); - let bar_h = bars.heights[i] as u32; + let bar_h = height as u32; let half_h = bar_h / 2; let top_y = center_y.saturating_sub(half_h); @@ -803,9 +803,9 @@ fn render_voice_bars( center_y: u32, start_x: u32, ) { - for i in 0..NUM_BARS { + for (i, &height) in bars.heights.iter().enumerate() { let bx = start_x + i as u32 * (BAR_WIDTH + BAR_GAP); - let bar_h = bars.heights[i] as u32; + let bar_h = height as u32; let half_h = bar_h / 2; let top_y = center_y.saturating_sub(half_h);