Skip to content

Commit 4eda240

Browse files
committed
Reduce allocations in missing_certs
1 parent a951e23 commit 4eda240

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main_logic.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use hickory_proto::rr::Name;
66
use openssl::pkey::PKey;
77
use std::collections::HashSet;
88
use std::io;
9+
use std::ops::Deref;
910
use std::path::Path;
1011
use std::{sync::Arc, time::Duration};
1112
use tracing::{debug_span, instrument, Instrument};
@@ -146,11 +147,12 @@ pub async fn process_config_certificate(
146147
let mut need_renewal = false;
147148
let days = config_cert.renewal_days_advance;
148149
let today_plus_validity = openssl::asn1::Asn1Time::days_from_now(days)?;
149-
let mut missing_certs: HashSet<String> = config_cert.domains.iter().cloned().collect();
150+
let mut missing_certs: HashSet<&str> =
151+
config_cert.domains.iter().map(Deref::deref).collect();
150152
for c in current_certs {
151153
for entry in c.subject_name().entries() {
152154
if let Ok(name) = entry.data().as_utf8() {
153-
missing_certs.remove(AsRef::<str>::as_ref(&name));
155+
missing_certs.remove(&name[..]);
154156
}
155157
}
156158
if let Some(alt_names) = c.subject_alt_names() {

0 commit comments

Comments
 (0)