From 0cbba6b2900906c7da22c69b95ee027ee47a76d8 Mon Sep 17 00:00:00 2001 From: jasonwitty Date: Mon, 11 Aug 2025 14:30:41 -0700 Subject: [PATCH] fix clippy format warnings --- socktop/src/ui/gpu.rs | 6 +++--- socktop/src/ui/header.rs | 2 +- socktop/src/ui/processes.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/socktop/src/ui/gpu.rs b/socktop/src/ui/gpu.rs index 544c6c4..d72cf00 100644 --- a/socktop/src/ui/gpu.rs +++ b/socktop/src/ui/gpu.rs @@ -75,7 +75,7 @@ pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) { let g = &gpus[i]; // Row 1: GPU name (and temp can be appended later) - let name_text = format!("{}", g.name); + let name_text = g.name.clone(); f.render_widget( Paragraph::new(Span::raw(name_text)).style(Style::default().fg(Color::Gray)), rows[i * 3], @@ -90,7 +90,7 @@ pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) { .ratio(util as f64 / 100.0); f.render_widget(util_gauge, util_cols[0]); f.render_widget( - Paragraph::new(Span::raw(format!("util: {}%", util))).style(Style::default().fg(Color::Gray)), + Paragraph::new(Span::raw(format!("util: {util}%"))).style(Style::default().fg(Color::Gray)), util_cols[1], ); @@ -107,7 +107,7 @@ pub fn draw_gpu(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) { .ratio(mem_ratio); f.render_widget(mem_gauge, mem_cols[0]); f.render_widget( - Paragraph::new(Span::raw(format!("vram: {}/{} ({}%)", fmt_bytes(used), fmt_bytes(total), mem_pct))) + Paragraph::new(Span::raw(format!("vram: {}/{} ({mem_pct}%)", fmt_bytes(used), fmt_bytes(total)))) .style(Style::default().fg(Color::Gray)), mem_cols[1], ); diff --git a/socktop/src/ui/header.rs b/socktop/src/ui/header.rs index b3b7df0..c830bfe 100644 --- a/socktop/src/ui/header.rs +++ b/socktop/src/ui/header.rs @@ -18,7 +18,7 @@ pub fn draw_header(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Metrics>) } else { "🔥" }; - format!("CPU Temp: {:.1}°C {}", t, icon) + format!("CPU Temp: {t:.1}°C {icon}") }) .unwrap_or_else(|| "CPU Temp: N/A".into()); format!( diff --git a/socktop/src/ui/processes.rs b/socktop/src/ui/processes.rs index 7af347d..b1cbfa9 100644 --- a/socktop/src/ui/processes.rs +++ b/socktop/src/ui/processes.rs @@ -64,7 +64,7 @@ pub fn draw_top_processes(f: &mut ratatui::Frame<'_>, area: Rect, m: Option<&Met Cell::from(p.name.clone()), Cell::from(format!("{:.1}%", p.cpu_usage)).style(Style::default().fg(cpu_fg)), Cell::from(human(p.mem_bytes)), - Cell::from(format!("{:.2}%", mem_pct)).style(Style::default().fg(mem_fg)), + Cell::from(format!("{mem_pct:.2}%")).style(Style::default().fg(mem_fg)), ]) .style(zebra.patch(emphasis)) })