clippy clean ups

This commit is contained in:
jasonwitty 2025-08-11 23:37:50 -07:00
parent 1e248306a6
commit 8d81ee1f7e
5 changed files with 7 additions and 8 deletions

View File

@ -138,7 +138,7 @@ impl App {
.as_ref() .as_ref()
.map(|mm| mm.cpu_per_core.len()) .map(|mm| mm.cpu_per_core.len())
.unwrap_or(0); .unwrap_or(0);
per_core_clamp( per_core_clamp(
&mut self.per_core_scroll, &mut self.per_core_scroll,
total_rows, total_rows,
content.height as usize, content.height as usize,

View File

@ -188,7 +188,7 @@ pub fn per_core_handle_scrollbar_mouse(
if d.active { if d.active {
let dy = (mouse.row as i32) - (d.start_y as i32); let dy = (mouse.row as i32) - (d.start_y as i32);
let new_top = (d.start_top as i32 + dy) let new_top = (d.start_top as i32 + dy)
.clamp(0, (track.saturating_sub(thumb_len)) as i32) .clamp(0, (track.saturating_sub(thumb_len)) as i32)
as usize; as usize;
// Inverse mapping top -> offset // Inverse mapping top -> offset
if track > thumb_len { if track > thumb_len {
@ -322,12 +322,12 @@ pub fn draw_per_core_bars(
.unwrap_or(curr); .unwrap_or(curr);
let trend = if curr > older + 0.2 { let trend = if curr > older + 0.2 {
"" ""
} else if curr + 0.2 < older { } else if curr + 0.2 < older {
"" ""
} else { } else {
"" ""
}; };
let fg = match curr { let fg = match curr {
x if x < 25.0 => Color::Green, x if x < 25.0 => Color::Green,

View File

@ -12,7 +12,7 @@ fn fmt_bytes(b: u64) -> String {
const MB: f64 = KB * 1024.0; const MB: f64 = KB * 1024.0;
const GB: f64 = MB * 1024.0; const GB: f64 = MB * 1024.0;
let fb = b as f64; let fb = b as f64;
if fb >= GB { if fb >= GB {
format!("{:.1}G", fb / GB) format!("{:.1}G", fb / GB)
} else if fb >= MB { } else if fb >= MB {
@ -21,8 +21,8 @@ fn fmt_bytes(b: u64) -> String {
format!("{:.1}K", fb / KB) format!("{:.1}K", fb / KB)
} else { } else {
format!("{b}B") format!("{b}B")
}
} }
}
pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) { pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) {
let mut area = area; let mut area = area;

View File

@ -21,4 +21,4 @@ pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>>
}; };
Ok(vec![metrics]) Ok(vec![metrics])
} }

View File

@ -30,7 +30,6 @@ pub struct AppState {
} }
impl AppState { impl AppState {
#[allow(dead_code)] #[allow(dead_code)]
pub fn new() -> Self { pub fn new() -> Self {
let sys = System::new(); // targeted refreshes per tick let sys = System::new(); // targeted refreshes per tick