feat: makes clippy happy

This commit is contained in:
2023-12-27 00:12:43 +08:00
parent 004df06df2
commit b7d3f77385
2 changed files with 5 additions and 5 deletions

View File

@@ -612,7 +612,7 @@ fn try_decrypt_key_ecdh_pgp_x25519(envelop: &TinyEncryptEnvelop, pin: &Option<St
} }
fn try_decrypt_key_gpg(envelop: &TinyEncryptEnvelop) -> XResult<Vec<u8>> { fn try_decrypt_key_gpg(envelop: &TinyEncryptEnvelop) -> XResult<Vec<u8>> {
Ok(util_gpg::gpg_decrypt(&envelop.encrypted_key)?) util_gpg::gpg_decrypt(&envelop.encrypted_key)
} }
#[cfg(feature = "macos")] #[cfg(feature = "macos")]

View File

@@ -50,7 +50,7 @@ pub fn gpg_encrypt(key_id: &str, message: &[u8]) -> XResult<String> {
.spawn(), "echo message failed: {}"); .spawn(), "echo message failed: {}");
let echo_stdout = opt_value_result!(echo.stdout, "Get echo stdout failed: none"); let echo_stdout = opt_value_result!(echo.stdout, "Get echo stdout failed: none");
let mut cmd = Command::new(&get_gpg_cmd()); let mut cmd = Command::new(get_gpg_cmd());
let encrypt_result = cmd let encrypt_result = cmd
.args([ .args([
"-e", "-a", "--no-comment", "-e", "-a", "--no-comment",
@@ -72,12 +72,12 @@ pub fn gpg_encrypt(key_id: &str, message: &[u8]) -> XResult<String> {
} }
pub fn gpg_decrypt(message: &str) -> XResult<Vec<u8>> { pub fn gpg_decrypt(message: &str) -> XResult<Vec<u8>> {
let echo = opt_result!(Command::new("echo").arg(&message) let echo = opt_result!(Command::new("echo").arg(message)
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn(), "echo message failed: {}"); .spawn(), "echo message failed: {}");
let echo_stdout = opt_value_result!(echo.stdout, "Get echo stdout failed: none"); let echo_stdout = opt_value_result!(echo.stdout, "Get echo stdout failed: none");
let mut cmd = Command::new(&get_gpg_cmd()); let mut cmd = Command::new(get_gpg_cmd());
let encrypt_result = cmd let encrypt_result = cmd
.arg("-d") .arg("-d")
.stdin(Stdio::from(echo_stdout)) .stdin(Stdio::from(echo_stdout))
@@ -91,7 +91,7 @@ pub fn gpg_decrypt(message: &str) -> XResult<Vec<u8>> {
decrypt_output.status.code(), stdout, stderr decrypt_output.status.code(), stdout, stderr
); );
} }
let decrypted = opt_result!(hex::decode(&stdout.trim()), "Decode decrypted message failed: {}"); let decrypted = opt_result!(hex::decode(stdout.trim()), "Decode decrypted message failed: {}");
Ok(decrypted) Ok(decrypted)
} }