From c1885ffc2ba219db639e1dd7d186884e6f7f4fdf Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sat, 20 Jun 2026 20:13:58 -0500 Subject: [PATCH] style: apply rustfmt to client.rs and vm.rs --- src-tauri/src/proxmox/client.rs | 12 ++++++++++-- src-tauri/src/proxmox/vm.rs | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/proxmox/client.rs b/src-tauri/src/proxmox/client.rs index fa98606a..6f569f91 100644 --- a/src-tauri/src/proxmox/client.rs +++ b/src-tauri/src/proxmox/client.rs @@ -136,7 +136,11 @@ impl ProxmoxClient { /// Build request headers with authentication. /// `include_csrf` should be true for POST / PUT / DELETE requests. - fn build_headers(&self, ticket: Option<&str>, include_csrf: bool) -> reqwest::header::HeaderMap { + fn build_headers( + &self, + ticket: Option<&str>, + include_csrf: bool, + ) -> reqwest::header::HeaderMap { let mut headers = reqwest::header::HeaderMap::new(); if let Some(token) = &self.api_token { @@ -395,7 +399,11 @@ mod tests { let headers = client.build_headers(Some("my-ticket"), true); assert!(headers.contains_key("CSRFPreventionToken")); - let csrf_val = headers.get("CSRFPreventionToken").unwrap().to_str().unwrap(); + let csrf_val = headers + .get("CSRFPreventionToken") + .unwrap() + .to_str() + .unwrap(); assert_eq!(csrf_val, "my-csrf"); } diff --git a/src-tauri/src/proxmox/vm.rs b/src-tauri/src/proxmox/vm.rs index 872d26b9..f08c19cd 100644 --- a/src-tauri/src/proxmox/vm.rs +++ b/src-tauri/src/proxmox/vm.rs @@ -151,8 +151,15 @@ pub async fn list_vms( if resource_type != "qemu" { return None; } - let name = r.get("name").and_then(|n| n.as_str()).map(|s| s.to_string()); - let status = r.get("status").and_then(|s| s.as_str()).unwrap_or("unknown").to_string(); + let name = r + .get("name") + .and_then(|n| n.as_str()) + .map(|s| s.to_string()); + let status = r + .get("status") + .and_then(|s| s.as_str()) + .unwrap_or("unknown") + .to_string(); // cpu may be absent for stopped VMs let cpu = r.get("cpu").and_then(|c| c.as_f64()).unwrap_or(0.0); @@ -166,7 +173,10 @@ pub async fn list_vms( uptime: r.get("uptime").and_then(|u| u.as_u64()).unwrap_or(0), node, template: r.get("template").and_then(|t| t.as_bool()), - agent: r.get("agent").and_then(|a| a.as_str()).map(|s| s.to_string()), + agent: r + .get("agent") + .and_then(|a| a.as_str()) + .map(|s| s.to_string()), mem: r.get("mem").and_then(|m| m.as_u64()), max_mem: r.get("maxmem").and_then(|m| m.as_u64()), max_disk: r.get("maxdisk").and_then(|d| d.as_u64()),