From 1c4583c82687d317404bac64ca0b735dbbf50b26 Mon Sep 17 00:00:00 2001 From: William Bruneau Date: Tue, 8 Sep 2026 13:47:07 +0200 Subject: [PATCH] Fix clippy --- server/src/lib.rs | 4 ++-- server/src/logic.rs | 2 +- server/src/monitoring.rs | 2 +- server/src/multipart.rs | 6 +++--- server/src/soap.rs | 2 +- server/src/tls.rs | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server/src/lib.rs b/server/src/lib.rs index b0d1cf0a..26e70a2a 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -1012,11 +1012,11 @@ fn create_tls_server( let subject = subject_from_cert(cert.as_ref()).expect("Could not parse client certificate"); - debug!("Incoming TLS connection from subject '{}'", &subject); + debug!("Incoming TLS connection from subject '{}'", subject); let issuer = issuer_from_cert(cert.as_ref()) .expect("Could not parse issuer from client certificate"); - debug!("Client certificate issued by '{}'", &issuer); + debug!("Client certificate issued by '{}'", issuer); debug!("Known CAs: {:?}", ca_thumbprints); // Try to find a trusted CA in the certificate chain diff --git a/server/src/logic.rs b/server/src/logic.rs index 37914b14..46ae63dc 100644 --- a/server/src/logic.rs +++ b/server/src/logic.rs @@ -149,7 +149,7 @@ async fn handle_enumerate( let current_subscriptions = { let subscriptions_unlocked = subscriptions.read().unwrap(); let mut current = Vec::with_capacity(subscriptions_unlocked.len()); - for (_, subscription) in subscriptions.read().unwrap().iter() { + for subscription in subscriptions.read().unwrap().values() { current.push(subscription.clone()); } current diff --git a/server/src/monitoring.rs b/server/src/monitoring.rs index 3331b38b..8f3d3a53 100644 --- a/server/src/monitoring.rs +++ b/server/src/monitoring.rs @@ -172,7 +172,7 @@ async fn refresh_machines_task( let subscriptions_data = { let subscriptions_unlocked = subscriptions.read().unwrap(); let mut subscriptions_data = Vec::with_capacity(subscriptions_unlocked.len()); - for (_, subscription) in subscriptions.read().unwrap().iter() { + for subscription in subscriptions.read().unwrap().values() { subscriptions_data.push((subscription.uuid_string(), subscription.data().name().to_string(), subscription.data().heartbeat_interval())); } subscriptions_data diff --git a/server/src/multipart.rs b/server/src/multipart.rs index 356fe985..64fbda5e 100644 --- a/server/src/multipart.rs +++ b/server/src/multipart.rs @@ -32,7 +32,7 @@ pub fn read_multipart_body( // Read the headers (which should end in 2 line terminators, but do not // for unknown reasons). But there are only headers in this part so this // is fine :) - buf.truncate(0); // start fresh + buf.clear(); // start fresh let (_, found) = reader.stream_until_token(middle_boundary.as_bytes(), &mut buf)?; if !found { bail!("EofInPartHeaders"); @@ -78,7 +78,7 @@ pub fn read_multipart_body( } // Read Content-Type header - buf.truncate(0); // start fresh + buf.clear(); // start fresh let (_, found) = reader.stream_until_token(<, &mut buf)?; if !found { bail!("No cr lf after headers"); @@ -108,7 +108,7 @@ pub fn read_multipart_body( } // Read interesting data - buf.truncate(0); // start fresh + buf.clear(); // start fresh let (size, found) = reader.stream_until_token(end_boundary.as_bytes(), &mut buf)?; if !found { log::error!( diff --git a/server/src/soap.rs b/server/src/soap.rs index 15387e64..d05c66a6 100644 --- a/server/src/soap.rs +++ b/server/src/soap.rs @@ -142,7 +142,7 @@ impl Serializable for SubscriptionBody { .write_inner_content(|writer| { writer.create_element("w:Heartbeats").write_text_content( BytesText::new( - format!("PT{}.000S", &self.heartbeat_interval).as_str(), + format!("PT{}.000S", self.heartbeat_interval).as_str(), ), )?; writer.create_element("e:NotifyTo").write_inner_content( diff --git a/server/src/tls.rs b/server/src/tls.rs index 49764736..3008816e 100644 --- a/server/src/tls.rs +++ b/server/src/tls.rs @@ -76,18 +76,18 @@ pub fn make_config(args: &common::settings::Tls) -> Result { for root in ca_certs { let subject = subject_from_cert(root.as_ref())?; let thumbprint = compute_thumbprint(root.as_ref()); - debug!("CA Thumbprint from certificate: {}", &thumbprint); + debug!("CA Thumbprint from certificate: {}", thumbprint); if let Some(existing) = ca_thumbprints.get(&subject) { if existing != &thumbprint { bail!( "Duplicate CA subject with different thumbprints: {}", - &subject + subject ); } // already present, skip, but warn warn!( "Duplicate CA certificate found for subject: {}, thumbprint: {}", - &subject, &thumbprint + subject, thumbprint ); continue; } @@ -204,10 +204,10 @@ pub fn find_matching_ca( .iter() .find_map(|cert| { let issuer = issuer_from_cert(cert.as_ref()).ok()?; - debug!("Checking issuer '{}'", &issuer); + debug!("Checking issuer '{}'", issuer); ca_thumbprints.get(&issuer).map(|ca_entry| { - debug!("Found matching CA for issuer '{}'", &issuer); + debug!("Found matching CA for issuer '{}'", issuer); ca_entry.clone() }) })