Skip to content

Commit 66de8a9

Browse files
committed
1 parent 8c3557e commit 66de8a9

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

src/keepassxc/messages/structs.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,17 @@ where
7474
);
7575
};
7676
response_wrapper.log();
77-
if response_wrapper.message.is_some() && response_wrapper.nonce.is_some() {
78-
let (message, nonce) = (
79-
response_wrapper.message.unwrap(),
80-
response_wrapper.nonce.unwrap(),
81-
);
82-
let decrypted_response_json = to_decrypted_json(message, nonce)?;
83-
let response: R = serde_json::from_str(&decrypted_response_json)?;
84-
Ok((response, decrypted_response_json))
85-
} else {
86-
Err(KeePassError {
77+
match (&response_wrapper.message, &response_wrapper.nonce) {
78+
(Some(message), Some(nonce)) => {
79+
let decrypted_response_json = to_decrypted_json(message, nonce)?;
80+
let response: R = serde_json::from_str(&decrypted_response_json)?;
81+
Ok((response, decrypted_response_json))
82+
}
83+
_ => Err(KeePassError {
8784
message: response_wrapper.error_message(),
8885
response: response_wrapper,
8986
}
90-
.into())
87+
.into()),
9188
}
9289
}
9390

src/utils/callers.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,8 @@ impl CurrentCaller {
5252
.ok_or_else(|| anyhow!("Failed to determine parent process path"))?;
5353
info!("Parent process path: {}", ppath.to_string_lossy());
5454
let canonical_ppath = ppath.canonicalize();
55-
if canonical_ppath.is_ok() {
56-
info!(
57-
"Canonical parent process path: {}",
58-
canonical_ppath.as_ref().unwrap().to_string_lossy()
59-
);
55+
if let Ok(p) = &canonical_ppath {
56+
info!("Canonical parent process path: {}", p.to_string_lossy());
6057
} else {
6158
warn!("Failed to determine canonical parent process path");
6259
}

0 commit comments

Comments
 (0)