diff --git a/local/docs/USB-IMPLEMENTATION-PLAN.md b/local/docs/archived/USB-IMPLEMENTATION-PLAN-v2-2026-07.md similarity index 100% rename from local/docs/USB-IMPLEMENTATION-PLAN.md rename to local/docs/archived/USB-IMPLEMENTATION-PLAN-v2-2026-07.md diff --git a/local/docs/USB-VALIDATION-RUNBOOK.md b/local/docs/archived/USB-VALIDATION-RUNBOOK-2026-07.md similarity index 100% rename from local/docs/USB-VALIDATION-RUNBOOK.md rename to local/docs/archived/USB-VALIDATION-RUNBOOK-2026-07.md diff --git a/local/recipes/system/redbear-power/source/src/app.rs b/local/recipes/system/redbear-power/source/src/app.rs index 866454a627..c61412178f 100644 --- a/local/recipes/system/redbear-power/source/src/app.rs +++ b/local/recipes/system/redbear-power/source/src/app.rs @@ -879,14 +879,8 @@ impl App { if prochot_now && !prochot_was { self.flash_toast("PROCHOT triggered \u{2014} throttling active"); } - self.throttle = if prochot_now { - if matches!(self.throttle, ThrottleMode::Auto) { - ThrottleMode::ForcedMin - } else { - self.throttle - } - } else if matches!(self.throttle, ThrottleMode::ForcedMin) { - self.throttle + self.throttle = if prochot_now && matches!(self.throttle, ThrottleMode::Auto) { + ThrottleMode::ForcedMin } else { self.throttle }; diff --git a/local/recipes/system/redbear-power/source/src/bench.rs b/local/recipes/system/redbear-power/source/src/bench.rs index f1da50f37a..7ff6fd4d8a 100644 --- a/local/recipes/system/redbear-power/source/src/bench.rs +++ b/local/recipes/system/redbear-power/source/src/bench.rs @@ -114,9 +114,9 @@ fn aes_worker(cancel: &AtomicBool, duration: Duration) -> u64 { for _ in 0..4 { for round in 0..10 { let rk_byte = key[round % 16]; - for j in 0..16 { - state[j] = state[j].wrapping_add(rk_byte); - state[j] = state[j].rotate_left(2); + for state_val in state.iter_mut() { + *state_val = state_val.wrapping_add(rk_byte); + *state_val = state_val.rotate_left(2); } } } diff --git a/local/recipes/system/redbear-power/source/src/cpufreq.rs b/local/recipes/system/redbear-power/source/src/cpufreq.rs index 2fc10a17dd..2b800d1a34 100644 --- a/local/recipes/system/redbear-power/source/src/cpufreq.rs +++ b/local/recipes/system/redbear-power/source/src/cpufreq.rs @@ -195,9 +195,7 @@ impl Cpufreq { /// Cycle to the next available governor. Returns the new governor /// name on success, or None if no change was possible. pub fn cycle(&mut self) -> Option { - let Some(ref backend) = self.backend else { - return None; - }; + let backend = self.backend.as_ref()?; if self.available.len() < 2 { return None; } diff --git a/local/recipes/system/redbear-power/source/src/dbus.rs b/local/recipes/system/redbear-power/source/src/dbus.rs index c131e52ef9..a7408a8a29 100644 --- a/local/recipes/system/redbear-power/source/src/dbus.rs +++ b/local/recipes/system/redbear-power/source/src/dbus.rs @@ -141,11 +141,7 @@ fn run_worker(rx: Receiver, cmd_tx: Sender) -> Zbus .object_server() .interface::<_, CpuPowerServer>("/org/redbear/Power") .await?; - loop { - let snap = match rx.recv() { - Ok(s) => s, - Err(_) => break, - }; + while let Ok(snap) = rx.recv() { let mut iface = iface_ref.get_mut().await; iface.cpu_count = snap.cpu_count; iface.avg_freq_khz = snap.avg_freq_khz; diff --git a/local/recipes/system/redbear-power/source/src/main.rs b/local/recipes/system/redbear-power/source/src/main.rs index e0d3916e8d..f040c8199a 100644 --- a/local/recipes/system/redbear-power/source/src/main.rs +++ b/local/recipes/system/redbear-power/source/src/main.rs @@ -165,19 +165,15 @@ fn hit_test(area: Rect, x: u16, y: u16) -> bool { fn handle_mouse(me: MouseEvent, header: &Rect, table: &Rect, keybar: &Rect, app: &mut App) { match me { - MouseEvent::Press(MouseButton::WheelUp, _x, y) => { - if hit_test(*table, _x, y) { - app.move_selection(-1); - } else if app.current_tab == TabId::Process { - app.move_selection(-1); - } + MouseEvent::Press(MouseButton::WheelUp, _x, y) + if (hit_test(*table, _x, y) || app.current_tab == TabId::Process) => + { + app.move_selection(-1); } - MouseEvent::Press(MouseButton::WheelDown, _x, y) => { - if hit_test(*table, _x, y) { - app.move_selection(1); - } else if app.current_tab == TabId::Process { - app.move_selection(1); - } + MouseEvent::Press(MouseButton::WheelDown, _x, y) + if (hit_test(*table, _x, y) || app.current_tab == TabId::Process) => + { + app.move_selection(1); } MouseEvent::Press(MouseButton::Left, x, y) => { if hit_test(*table, x, y) { diff --git a/local/recipes/system/redbear-power/source/src/process.rs b/local/recipes/system/redbear-power/source/src/process.rs index 0302a73cc5..53b8d6769b 100644 --- a/local/recipes/system/redbear-power/source/src/process.rs +++ b/local/recipes/system/redbear-power/source/src/process.rs @@ -92,7 +92,7 @@ impl SortMode { SortMode::ThreadIoW => "T-IO-W", } } - pub fn sort(self, processes: &mut Vec) { + pub fn sort(self, processes: &mut [ProcessInfo]) { // v1.38: direction is fixed at descending. The app // calls `sort_ascending(processes, true)` for ascending // sorts. Default false keeps backward compatibility for @@ -104,7 +104,7 @@ impl SortMode { /// the comparator for every sort mode. htop parity: the /// `i` key toggles the App's `sort_ascending` flag and /// re-sorts the visible processes. - pub fn sort_ascending(self, processes: &mut Vec, ascending: bool) { + pub fn sort_ascending(self, processes: &mut [ProcessInfo], ascending: bool) { if ascending { match self { SortMode::Rss => processes.sort_by_key(|a| a.rss_kb), @@ -148,7 +148,7 @@ impl SortMode { } } else { match self { - SortMode::Rss => processes.sort_by(|a, b| b.rss_kb.cmp(&a.rss_kb)), + SortMode::Rss => processes.sort_by_key(|b| std::cmp::Reverse(b.rss_kb)), SortMode::Cpu => processes.sort_by(|a, b| { b.cpu_pct .partial_cmp(&a.cpu_pct) @@ -169,9 +169,9 @@ impl SortMode { SortMode::IoRate => sort_by_io_rate_field(processes, |p| p.io_total_rate_kbs()), SortMode::IoReadRate => sort_by_io_rate_field(processes, |p| p.io_read_rate_kbs), SortMode::IoWriteRate => sort_by_io_rate_field(processes, |p| p.io_write_rate_kbs), - SortMode::RChar => processes.sort_by(|a, b| b.io_rchar_kb.cmp(&a.io_rchar_kb)), - SortMode::WChar => processes.sort_by(|a, b| b.io_wchar_kb.cmp(&a.io_wchar_kb)), - SortMode::VSize => processes.sort_by(|a, b| b.vsize_kb.cmp(&a.vsize_kb)), + SortMode::RChar => processes.sort_by_key(|b| std::cmp::Reverse(b.io_rchar_kb)), + SortMode::WChar => processes.sort_by_key(|b| std::cmp::Reverse(b.io_wchar_kb)), + SortMode::VSize => processes.sort_by_key(|b| std::cmp::Reverse(b.vsize_kb)), SortMode::Pid => processes.sort_by_key(|p| p.pid), SortMode::Name => processes.sort_by(|a, b| a.comm.cmp(&b.comm)), SortMode::ThreadIo => sort_by_io_field(processes, |p| { @@ -187,7 +187,7 @@ impl SortMode { } } -fn sort_by_io_field(processes: &mut Vec, field: F) +fn sort_by_io_field(processes: &mut [ProcessInfo], field: F) where F: Fn(&ProcessInfo) -> Option, { @@ -207,7 +207,7 @@ where /// helpers (one for each direction) keep the per-direction /// comparator logic local and avoid a runtime branch inside /// the closure. -fn sort_by_io_field_asc(processes: &mut Vec, field: F) +fn sort_by_io_field_asc(processes: &mut [ProcessInfo], field: F) where F: Fn(&ProcessInfo) -> Option, { @@ -223,7 +223,7 @@ where }); } -fn sort_by_io_rate_field(processes: &mut Vec, field: F) +fn sort_by_io_rate_field(processes: &mut [ProcessInfo], field: F) where F: Fn(&ProcessInfo) -> Option, { @@ -239,7 +239,7 @@ where }); } -fn sort_by_io_rate_field_asc(processes: &mut Vec, field: F) +fn sort_by_io_rate_field_asc(processes: &mut [ProcessInfo], field: F) where F: Fn(&ProcessInfo) -> Option, { diff --git a/local/recipes/system/redbear-power/source/src/render.rs b/local/recipes/system/redbear-power/source/src/render.rs index fd9372f2e7..2a7844d1d3 100644 --- a/local/recipes/system/redbear-power/source/src/render.rs +++ b/local/recipes/system/redbear-power/source/src/render.rs @@ -730,6 +730,7 @@ pub fn render_info_panel<'a>(app: &'a App, focused: bool) -> Paragraph<'a> { .wrap(Wrap { trim: true }) } +#[allow(clippy::vec_init_then_push)] pub fn render_motherboard_panel<'a>(app: &'a App, focused: bool) -> Paragraph<'a> { let dmi = &app.dmi; let empty_msg = if dmi.is_empty() { @@ -2221,7 +2222,7 @@ pub fn render_help<'a>(help_scroll: usize, theme: &Theme) -> Paragraph<'a> { let total = lines.len(); let start = help_scroll.min(total); let visible: String = lines[start..].join("\n"); - let pct = if total > 0 { start * 100 / total } else { 0 }; + let pct = (start * 100).checked_div(total).unwrap_or(0); Paragraph::new(visible) .style(theme::VALUE) .wrap(Wrap { trim: true })