From 11168b22dfee4af1bf3719dd76d6ca48391fcbc9 Mon Sep 17 00:00:00 2001 From: Echo Date: Mon, 18 May 2026 23:54:15 +0000 Subject: [PATCH] style: fix rustfmt formatting for CI --- src/enroll/identity.rs | 8 ++++++-- src/enroll/mod.rs | 4 ++-- tests/integration/enrollment_test.rs | 5 ++++- tests/unit/enroll_identity.rs | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/enroll/identity.rs b/src/enroll/identity.rs index 71c6924..57307eb 100644 --- a/src/enroll/identity.rs +++ b/src/enroll/identity.rs @@ -53,11 +53,15 @@ pub fn get_fqdn() -> Result { // 2. Try combining short hostname + domain from `hostname -d` if let Ok(short_output) = Command::new("hostname").output() { if short_output.status.success() { - let short = String::from_utf8_lossy(&short_output.stdout).trim().to_string(); + let short = String::from_utf8_lossy(&short_output.stdout) + .trim() + .to_string(); if !short.is_empty() && short != "(none)" { if let Ok(domain_output) = Command::new("hostname").arg("-d").output() { if domain_output.status.success() { - let domain = String::from_utf8_lossy(&domain_output.stdout).trim().to_string(); + let domain = String::from_utf8_lossy(&domain_output.stdout) + .trim() + .to_string(); if !domain.is_empty() { let fqdn = format!("{}.{}", short, domain); tracing::debug!(fqdn = %fqdn, "Resolved FQDN via hostname + hostname -d"); diff --git a/src/enroll/mod.rs b/src/enroll/mod.rs index d1720a8..dd04a07 100644 --- a/src/enroll/mod.rs +++ b/src/enroll/mod.rs @@ -16,8 +16,8 @@ pub use client::{ }; /// Re-export identity extraction functions. pub use identity::{ - get_fqdn, get_hostname, get_ip_addresses, get_ip_for_interface, get_machine_id, - get_os_details, get_primary_ip, get_route_source_ip, is_container_bridge, is_link_local, + get_fqdn, get_hostname, get_ip_addresses, get_ip_for_interface, get_machine_id, get_os_details, + get_primary_ip, get_route_source_ip, is_container_bridge, is_link_local, }; /// Run the full enrollment flow against the manager at the given URL. diff --git a/tests/integration/enrollment_test.rs b/tests/integration/enrollment_test.rs index db01dcd..24d3719 100644 --- a/tests/integration/enrollment_test.rs +++ b/tests/integration/enrollment_test.rs @@ -477,7 +477,10 @@ async fn test_registration_payload_structure() { // Verify hostname field (optional, may be present or absent) // When present, it should be a non-empty string without dots (short hostname) if let Some(hostname) = payload.get("hostname").and_then(|v| v.as_str()) { - assert!(!hostname.is_empty(), "hostname should not be empty when present"); + assert!( + !hostname.is_empty(), + "hostname should not be empty when present" + ); assert!( !hostname.contains('.'), "hostname should be short form (no dots), got: {}", diff --git a/tests/unit/enroll_identity.rs b/tests/unit/enroll_identity.rs index b3c6196..7927e7c 100644 --- a/tests/unit/enroll_identity.rs +++ b/tests/unit/enroll_identity.rs @@ -203,8 +203,8 @@ fn test_enrollment_hostname_field_serializes() { os_details: serde_json::json!({"name": "Test"}), hostname: Some("host".to_string()), }; - let json_with = serde_json::to_string(&request_with_hostname) - .expect("Should serialize with hostname"); + let json_with = + serde_json::to_string(&request_with_hostname).expect("Should serialize with hostname"); assert!( json_with.contains("\"hostname\""), "hostname field should be present in JSON when Some"