Skip to content

Commit 8604bb2

Browse files
committed
address final review nits
Signed-off-by: Rajat Jindal <[email protected]>
1 parent 881c3bb commit 8604bb2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/trigger-http/src/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ pub fn load_certs(
4242
)
4343
},
4444
)?))
45-
.collect::<io::Result<Vec<rustls_pki_types::CertificateDer<'static>>>>()
45+
.collect()
4646
}
4747

48-
// load_keys parse and return the first private key from the provided file
48+
// parse and return the first private key from the provided file
4949
pub fn load_key(path: impl AsRef<Path>) -> io::Result<rustls_pki_types::PrivateKeyDer<'static>> {
5050
private_key(&mut io::BufReader::new(fs::File::open(path).map_err(
5151
|err| {

crates/trigger/src/runtime_config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ impl RuntimeConfig {
198198
existing_opts: Option<&HashMap<Authority, ParsedClientTlsOpts>>,
199199
host: Authority,
200200
newopts: ParsedClientTlsOpts,
201-
) -> Option<(Authority, ParsedClientTlsOpts)> {
201+
) -> (Authority, ParsedClientTlsOpts) {
202202
match existing_opts {
203-
None => Some((host, newopts.clone())),
203+
None => (host, newopts),
204204
Some(opts) => match opts.get(&host) {
205205
Some(existing_opts_for_component_and_host) => {
206-
Some((host, existing_opts_for_component_and_host.to_owned()))
206+
(host, existing_opts_for_component_and_host.to_owned())
207207
}
208-
None => Some((host, newopts.clone())),
208+
None => (host, newopts),
209209
},
210210
}
211211
}
@@ -214,21 +214,21 @@ impl RuntimeConfig {
214214
for opts in &opt_layer.client_tls_opts {
215215
let parsed = parse_client_tls_opts(opts).context("parsing client tls options")?;
216216
for component_id in &opts.component_ids {
217-
let existing_opts_for_component = components_map.get(&component_id.to_string());
217+
let existing_opts_for_component = components_map.get(component_id.as_ref());
218218
#[allow(clippy::mutable_key_type)]
219219
let hostmap = parsed
220220
.hosts
221221
.clone()
222222
.into_iter()
223-
.filter_map(|host| {
223+
.map(|host| {
224224
use_existing_if_available(
225225
existing_opts_for_component,
226226
host,
227227
parsed.clone(),
228228
)
229229
})
230230
.collect::<HashMap<Authority, ParsedClientTlsOpts>>();
231-
components_map.insert(component_id.to_string().to_owned(), hostmap);
231+
components_map.insert(component_id.to_string(), hostmap);
232232
}
233233
}
234234
}

0 commit comments

Comments
 (0)