clippy clean up

This commit is contained in:
jasonwitty 2025-08-11 22:44:43 -07:00
parent 4c6c707dd0
commit 11506699e3
4 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ pub struct GpuMetrics {
pub name: String,
pub utilization_gpu_pct: u32, // 0..100
pub mem_used_bytes: u64,
pub mem_total_bytes: u64
pub mem_total_bytes: u64,
}
pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>> {
@ -17,7 +17,7 @@ pub fn collect_all_gpus() -> Result<Vec<GpuMetrics>, Box<dyn std::error::Error>>
name: gpu.model().to_string(),
utilization_gpu_pct: info.load_pct() as u32,
mem_used_bytes: info.used_vram(),
mem_total_bytes: info.total_vram()
mem_total_bytes: info.total_vram(),
};
Ok(vec![metrics])

View File

@ -62,7 +62,7 @@ async fn main() {
wake_sampler: Arc::new(Notify::new()),
auth_token: std::env::var("SOCKTOP_TOKEN")
.ok()
.filter(|s| !s.is_empty())
.filter(|s| !s.is_empty()),
};
// Start background sampler (adjust cadence as needed)

View File

@ -13,13 +13,13 @@ pub struct Metrics {
pub swap_total_mb: u64,
pub swap_used_mb: u64,
pub net_aggregate: NetTotals,
pub top_processes: Vec<Proc>
pub top_processes: Vec<Proc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetTotals {
pub rx_bytes: u64,
pub tx_bytes: u64
pub tx_bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -28,5 +28,5 @@ pub struct Proc {
pub name: String,
pub cpu: f32,
pub mem_mb: u64,
pub status: String
pub status: String,
}

View File

@ -45,7 +45,7 @@ impl AppState {
last_json: Arc::new(RwLock::new(String::new())),
client_count: Arc::new(AtomicUsize::new(0)),
wake_sampler: Arc::new(Notify::new()),
auth_token: std::env::var("SOCKTOP_TOKEN").ok().filter(|s| !s.is_empty())
auth_token: std::env::var("SOCKTOP_TOKEN").ok().filter(|s| !s.is_empty()),
}
}
}