use inline format args (clippy::uninlined_format_args)

This commit is contained in:
Daniel Eades 2024-04-14 20:53:23 +01:00 • committed by Jeremy Soller
parent fa744071f8
commit dcae0a4c2e
3 changed files with 12 additions and 14 deletions

View file

@ -43,6 +43,6 @@ pub fn localize() {
let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages(); let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages();
if let Err(error) = localizer.select(&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}");
} }
} }

View file

@ -75,7 +75,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(fork::Fork::Child) => (), Ok(fork::Fork::Child) => (),
Ok(fork::Fork::Parent(_child_pid)) => process::exit(0), Ok(fork::Fork::Parent(_child_pid)) => process::exit(0),
Err(err) => { Err(err) => {
eprintln!("failed to daemonize: {:?}", err); eprintln!("failed to daemonize: {err:?}");
process::exit(1); process::exit(1);
} }
} }
@ -656,7 +656,7 @@ impl App {
hash = short_hash.as_str(), hash = short_hash.as_str(),
date = date date = date
)) ))
.on_press(Message::LaunchUrl(format!("{}/commits/{}", repository, hash))) .on_press(Message::LaunchUrl(format!("{repository}/commits/{hash}")))
.padding(0) .padding(0)
.into(), .into(),
]) ])
@ -1341,7 +1341,7 @@ impl Application for App {
let mut font_size_names = Vec::new(); let mut font_size_names = Vec::new();
let mut font_sizes = Vec::new(); let mut font_sizes = Vec::new();
for font_size in 4..=32 { 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); font_sizes.push(font_size);
} }
@ -1597,7 +1597,7 @@ impl Application for App {
Ok(ok) => ok, Ok(ok) => ok,
Err(err) => { Err(err) => {
self.color_scheme_errors self.color_scheme_errors
.push(format!("Failed to open {:?}: {}", path, err)); .push(format!("Failed to open {path:?}: {err}"));
continue; continue;
} }
}; };
@ -1616,7 +1616,7 @@ impl Application for App {
} }
Err(err) => { Err(err) => {
self.color_scheme_errors self.color_scheme_errors
.push(format!("Failed to parse {:?}: {}", path, err)); .push(format!("Failed to parse {path:?}: {err}"));
} }
} }
} }

View file

@ -698,8 +698,7 @@ where
match named { match named {
Named::Backspace => { Named::Backspace => {
let code = if modifiers.control() { "\x08" } else { "\x7f" }; let code = if modifiers.control() { "\x08" } else { "\x7f" };
terminal terminal.input_scroll(format!("{alt_prefix}{code}").as_bytes().to_vec());
.input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec());
status = Status::Captured; status = Status::Captured;
} }
Named::Enter => { Named::Enter => {
@ -728,8 +727,7 @@ where
} }
Named::Tab => { Named::Tab => {
let code = if modifiers.shift() { "\x1b[Z" } else { "\x09" }; let code = if modifiers.shift() { "\x1b[Z" } else { "\x09" };
terminal terminal.input_scroll(format!("{alt_prefix}{code}").as_bytes().to_vec());
.input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec());
status = Status::Captured; status = Status::Captured;
} }
_ => {} _ => {}
@ -1151,10 +1149,10 @@ fn calculate_modifier_number(state: &mut State) -> u8 {
#[inline(always)] #[inline(always)]
fn csi(code: &str, suffix: &str, modifiers: u8) -> Option<Vec<u8>> { fn csi(code: &str, suffix: &str, modifiers: u8) -> Option<Vec<u8>> {
if modifiers == 1 { if modifiers == 1 {
Some(format!("\x1B[{}{}", code, suffix).as_bytes().to_vec()) Some(format!("\x1B[{code}{suffix}").as_bytes().to_vec())
} else { } else {
Some( Some(
format!("\x1B[{};{}{}", code, modifiers, suffix) format!("\x1B[{code};{modifiers}{suffix}")
.as_bytes() .as_bytes()
.to_vec(), .to_vec(),
) )
@ -1164,8 +1162,8 @@ fn csi(code: &str, suffix: &str, modifiers: u8) -> Option<Vec<u8>> {
#[inline(always)] #[inline(always)]
fn ss3(code: &str, modifiers: u8) -> Option<Vec<u8>> { fn ss3(code: &str, modifiers: u8) -> Option<Vec<u8>> {
if modifiers == 1 { if modifiers == 1 {
Some(format!("\x1B\x4F{}", code).as_bytes().to_vec()) Some(format!("\x1B\x4F{code}").as_bytes().to_vec())
} else { } else {
Some(format!("\x1B[1;{}{}", modifiers, code).as_bytes().to_vec()) Some(format!("\x1B[1;{modifiers}{code}").as_bytes().to_vec())
} }
} }