diff --git a/examples/generate-docs.rs b/examples/generate-docs.rs index 99c42d2..11d91e3 100644 --- a/examples/generate-docs.rs +++ b/examples/generate-docs.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; const MANPAGES_DIR: &str = "./target/manpages"; 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"); let mut encoder = GzEncoder::new(file, Compression::best()); encoder diff --git a/src/key.rs b/src/key.rs index 05d80b4..71940e8 100644 --- a/src/key.rs +++ b/src/key.rs @@ -326,7 +326,7 @@ pub(crate) fn manage(yubikey: &mut YubiKey) -> Result<(), Error> { let pin = request_pin( |prev_error| { if let Some(err) = prev_error { - eprintln!("{}", err); + eprintln!("{err}"); } Password::new() .with_prompt(fl!("mgr-choose-new-pin")) diff --git a/src/main.rs b/src/main.rs index 3add1be..0bbb5f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -296,8 +296,8 @@ fn list(flags: PluginFlags, all: bool) -> Result<(), Error> { flags, all, |_, recipient, metadata| { - println!("{}", metadata); - println!("{}", recipient); + println!("{metadata}"); + println!("{recipient}"); }, ) } @@ -411,9 +411,9 @@ fn main() -> Result<(), Error> { .validity() .not_before .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`. let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age"); - let encrypt_usage = format!( - "$ cat foo.txt | {} -r {} -o foo.txt.age", - age_binary, recipient - ); - let decrypt_usage = format!( - "$ cat foo.txt.age | {} -d -i {} > foo.txt", - age_binary, file_name - ); + let encrypt_usage = format!("$ cat foo.txt | {age_binary} -r {recipient} -o foo.txt.age"); + let decrypt_usage = format!("$ cat foo.txt.age | {age_binary} -d -i {file_name} > foo.txt"); let identity_usage = format!( "$ age-plugin-yubikey -i --serial {} --slot {} > {}", stub.serial, diff --git a/src/util.rs b/src/util.rs index bf57573..b44d221 100644 --- a/src/util.rs +++ b/src/util.rs @@ -177,7 +177,7 @@ impl Metadata { .validity() .not_before .to_rfc2822() - .unwrap_or_else(|e| format!("Invalid date: {}", e)), + .unwrap_or_else(|e| format!("Invalid date: {e}")), pin_policy, touch_policy, })