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

@@ -50,7 +50,7 @@ pub fn gpg_encrypt(key_id: &str, message: &[u8]) -> XResult<String> {
.spawn(), "echo message failed: {}");
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
.args([
"-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>> {
let echo = opt_result!(Command::new("echo").arg(&message)
let echo = opt_result!(Command::new("echo").arg(message)
.stdout(Stdio::piped())
.spawn(), "echo message failed: {}");
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
.arg("-d")
.stdin(Stdio::from(echo_stdout))
@@ -91,7 +91,7 @@ pub fn gpg_decrypt(message: &str) -> XResult<Vec<u8>> {
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)
}