Fix 1.67 clippy lints

This commit is contained in:
Jack Grigg
2024-07-30 05:42:54 +00:00
parent 24e6e6ffa6
commit 34011088a0
4 changed files with 9 additions and 15 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ use std::io::prelude::*;
const MANPAGES_DIR: &str = "./target/manpages"; const MANPAGES_DIR: &str = "./target/manpages";
fn generate_manpage(page: String, name: &str) { fn generate_manpage(page: String, name: &str) {
let file = File::create(format!("{}/{}.1.gz", MANPAGES_DIR, name)) let file = File::create(format!("{MANPAGES_DIR}/{name}.1.gz"))
.expect("Should be able to open file in target directory"); .expect("Should be able to open file in target directory");
let mut encoder = GzEncoder::new(file, Compression::best()); let mut encoder = GzEncoder::new(file, Compression::best());
encoder encoder
+1 -1
View File
@@ -326,7 +326,7 @@ pub(crate) fn manage(yubikey: &mut YubiKey) -> Result<(), Error> {
let pin = request_pin( let pin = request_pin(
|prev_error| { |prev_error| {
if let Some(err) = prev_error { if let Some(err) = prev_error {
eprintln!("{}", err); eprintln!("{err}");
} }
Password::new() Password::new()
.with_prompt(fl!("mgr-choose-new-pin")) .with_prompt(fl!("mgr-choose-new-pin"))
+6 -12
View File
@@ -296,8 +296,8 @@ fn list(flags: PluginFlags, all: bool) -> Result<(), Error> {
flags, flags,
all, all,
|_, recipient, metadata| { |_, recipient, metadata| {
println!("{}", metadata); println!("{metadata}");
println!("{}", recipient); println!("{recipient}");
}, },
) )
} }
@@ -411,9 +411,9 @@ fn main() -> Result<(), Error> {
.validity() .validity()
.not_before .not_before
.to_rfc2822() .to_rfc2822()
.unwrap_or_else(|e| format!("Invalid date: {}", e)); .unwrap_or_else(|e| format!("Invalid date: {e}"));
format!("{}, created: {}", name, created) format!("{name}, created: {created}")
}) })
}) })
}) })
@@ -631,14 +631,8 @@ fn main() -> Result<(), Error> {
// If `rage` binary is installed, use it in examples. Otherwise default to `age`. // If `rage` binary is installed, use it in examples. Otherwise default to `age`.
let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age"); let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age");
let encrypt_usage = format!( let encrypt_usage = format!("$ cat foo.txt | {age_binary} -r {recipient} -o foo.txt.age");
"$ cat foo.txt | {} -r {} -o foo.txt.age", let decrypt_usage = format!("$ cat foo.txt.age | {age_binary} -d -i {file_name} > foo.txt");
age_binary, recipient
);
let decrypt_usage = format!(
"$ cat foo.txt.age | {} -d -i {} > foo.txt",
age_binary, file_name
);
let identity_usage = format!( let identity_usage = format!(
"$ age-plugin-yubikey -i --serial {} --slot {} > {}", "$ age-plugin-yubikey -i --serial {} --slot {} > {}",
stub.serial, stub.serial,
+1 -1
View File
@@ -177,7 +177,7 @@ impl Metadata {
.validity() .validity()
.not_before .not_before
.to_rfc2822() .to_rfc2822()
.unwrap_or_else(|e| format!("Invalid date: {}", e)), .unwrap_or_else(|e| format!("Invalid date: {e}")),
pin_policy, pin_policy,
touch_policy, touch_policy,
}) })