clippy clean ups
This commit is contained in:
parent
1e248306a6
commit
8d81ee1f7e
@ -138,7 +138,7 @@ impl App {
|
||||
.as_ref()
|
||||
.map(|mm| mm.cpu_per_core.len())
|
||||
.unwrap_or(0);
|
||||
per_core_clamp(
|
||||
per_core_clamp(
|
||||
&mut self.per_core_scroll,
|
||||
total_rows,
|
||||
content.height as usize,
|
||||
|
||||
@ -188,7 +188,7 @@ pub fn per_core_handle_scrollbar_mouse(
|
||||
if d.active {
|
||||
let dy = (mouse.row as i32) - (d.start_y as i32);
|
||||
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;
|
||||
// Inverse mapping top -> offset
|
||||
if track > thumb_len {
|
||||
@ -322,12 +322,12 @@ pub fn draw_per_core_bars(
|
||||
.unwrap_or(curr);
|
||||
|
||||
let trend = if curr > older + 0.2 {
|
||||
"↑"
|
||||
"↑"
|
||||
} else if curr + 0.2 < older {
|
||||
"↓"
|
||||
} else {
|
||||
"╌"
|
||||
};
|
||||
};
|
||||
|
||||
let fg = match curr {
|
||||
x if x < 25.0 => Color::Green,
|
||||
|
||||
@ -12,7 +12,7 @@ fn fmt_bytes(b: u64) -> String {
|
||||
const MB: f64 = KB * 1024.0;
|
||||
const GB: f64 = MB * 1024.0;
|
||||
let fb = b as f64;
|
||||
|
||||
|
||||
if fb >= GB {
|
||||
format!("{:.1}G", fb / GB)
|
||||
} else if fb >= MB {
|
||||
@ -21,8 +21,8 @@ fn fmt_bytes(b: u64) -> String {
|
||||
format!("{:.1}K", fb / KB)
|
||||
} else {
|
||||
format!("{b}B")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) {
|
||||
let mut area = area;
|
||||
|
||||
@ -21,4 +21,4 @@ pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>>
|
||||
};
|
||||
|
||||
Ok(vec![metrics])
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ pub struct AppState {
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn new() -> Self {
|
||||
let sys = System::new(); // targeted refreshes per tick
|
||||
|
||||
Loading…
Reference in New Issue
Block a user