Skip to content

Commit

Permalink
Flatten if clause
Browse files Browse the repository at this point in the history
  • Loading branch information
isbm committed Nov 7, 2024
1 parent 231d108 commit 6f0ae75
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sysmaster/src/registry/mkb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@ impl MinionsKeyRegistry {

match fs::read_to_string(k_pth) {
Ok(pbk_pem) => {
if let Ok((_, pbk)) = rsa::keys::from_pem(None, Some(&pbk_pem)) {
if let Some(pbk) = pbk {
self.keys.insert(mid.to_string(), Some(pbk.to_owned()));
return Some(pbk);
}
if let Ok((_, Some(pbk))) = rsa::keys::from_pem(None, Some(&pbk_pem)) {
self.keys.insert(mid.to_string(), Some(pbk.to_owned()));
return Some(pbk);
}
}
Err(err) => log::error!("Unable to read minion RSA key: {err}"),
Expand Down

0 comments on commit 6f0ae75

Please sign in to comment.