From dcae0a4c2ec2727630a7b9356fd30d467b44b49d Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 14 Apr 2024 20:53:23 +0100 Subject: [PATCH] use inline format args (clippy::uninlined_format_args) --- src/localize.rs | 2 +- src/main.rs | 10 +++++----- src/terminal_box.rs | 14 ++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/localize.rs b/src/localize.rs index f5c6fb9..012d25f 100644 --- a/src/localize.rs +++ b/src/localize.rs @@ -43,6 +43,6 @@ pub fn localize() { let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages(); if let Err(error) = localizer.select(&requested_languages) { - eprintln!("Error while loading language for App List {}", error); + eprintln!("Error while loading language for App List {error}"); } } diff --git a/src/main.rs b/src/main.rs index c0a1fb1..ee7935a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,7 @@ fn main() -> Result<(), Box> { Ok(fork::Fork::Child) => (), Ok(fork::Fork::Parent(_child_pid)) => process::exit(0), Err(err) => { - eprintln!("failed to daemonize: {:?}", err); + eprintln!("failed to daemonize: {err:?}"); process::exit(1); } } @@ -656,7 +656,7 @@ impl App { hash = short_hash.as_str(), date = date )) - .on_press(Message::LaunchUrl(format!("{}/commits/{}", repository, hash))) + .on_press(Message::LaunchUrl(format!("{repository}/commits/{hash}"))) .padding(0) .into(), ]) @@ -1341,7 +1341,7 @@ impl Application for App { let mut font_size_names = Vec::new(); let mut font_sizes = Vec::new(); for font_size in 4..=32 { - font_size_names.push(format!("{}px", font_size)); + font_size_names.push(format!("{font_size}px")); font_sizes.push(font_size); } @@ -1597,7 +1597,7 @@ impl Application for App { Ok(ok) => ok, Err(err) => { self.color_scheme_errors - .push(format!("Failed to open {:?}: {}", path, err)); + .push(format!("Failed to open {path:?}: {err}")); continue; } }; @@ -1616,7 +1616,7 @@ impl Application for App { } Err(err) => { self.color_scheme_errors - .push(format!("Failed to parse {:?}: {}", path, err)); + .push(format!("Failed to parse {path:?}: {err}")); } } } diff --git a/src/terminal_box.rs b/src/terminal_box.rs index 6b26101..48056c4 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -698,8 +698,7 @@ where match named { Named::Backspace => { let code = if modifiers.control() { "\x08" } else { "\x7f" }; - terminal - .input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec()); + terminal.input_scroll(format!("{alt_prefix}{code}").as_bytes().to_vec()); status = Status::Captured; } Named::Enter => { @@ -728,8 +727,7 @@ where } Named::Tab => { let code = if modifiers.shift() { "\x1b[Z" } else { "\x09" }; - terminal - .input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec()); + terminal.input_scroll(format!("{alt_prefix}{code}").as_bytes().to_vec()); status = Status::Captured; } _ => {} @@ -1151,10 +1149,10 @@ fn calculate_modifier_number(state: &mut State) -> u8 { #[inline(always)] fn csi(code: &str, suffix: &str, modifiers: u8) -> Option> { if modifiers == 1 { - Some(format!("\x1B[{}{}", code, suffix).as_bytes().to_vec()) + Some(format!("\x1B[{code}{suffix}").as_bytes().to_vec()) } else { Some( - format!("\x1B[{};{}{}", code, modifiers, suffix) + format!("\x1B[{code};{modifiers}{suffix}") .as_bytes() .to_vec(), ) @@ -1164,8 +1162,8 @@ fn csi(code: &str, suffix: &str, modifiers: u8) -> Option> { #[inline(always)] fn ss3(code: &str, modifiers: u8) -> Option> { if modifiers == 1 { - Some(format!("\x1B\x4F{}", code).as_bytes().to_vec()) + Some(format!("\x1B\x4F{code}").as_bytes().to_vec()) } else { - Some(format!("\x1B[1;{}{}", modifiers, code).as_bytes().to_vec()) + Some(format!("\x1B[1;{modifiers}{code}").as_bytes().to_vec()) } }