Skip to content

Commit 71ea773

Browse files
committed
use iterator for creating host -> client opts map
Signed-off-by: Rajat Jindal <[email protected]>
1 parent 108e2a3 commit 71ea773

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

crates/trigger/src/runtime_config.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ impl RuntimeConfig {
196196
for opts in &opt_layer.client_tls_opts {
197197
let parsed = parse_client_tls_opts(opts).context("parsing client tls options")?;
198198
for component_id in &opts.component_ids {
199-
let mut hostmap: HashMap<Authority, ParsedClientTlsOpts> = HashMap::new();
200-
for host in &parsed.hosts {
201-
hostmap.insert(host.to_owned(), parsed.clone());
202-
}
203-
199+
let hostmap = parsed
200+
.hosts
201+
.clone()
202+
.into_iter()
203+
.map(|host| (host, parsed.clone()))
204+
.collect::<HashMap<Authority, ParsedClientTlsOpts>>();
204205
components_map.insert(component_id.to_owned(), hostmap);
205206
}
206207
}

0 commit comments

Comments
 (0)