From 05735887b9a8fb6852da84699761508cf25e10ae Mon Sep 17 00:00:00 2001 From: Gabriele Belluardo Date: Tue, 17 Jun 2025 00:17:10 +0200 Subject: [PATCH] fix(clippy): uninlined_format_args --- src/uu/date/src/date.rs | 2 +- src/uu/more/src/more.rs | 4 ++-- src/uu/numfmt/src/format.rs | 2 +- src/uu/tail/src/args.rs | 2 +- src/uu/tr/src/operation.rs | 2 +- src/uucore/src/lib/mods/locale.rs | 5 ++--- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 9f8b4c095..379aba67f 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -270,7 +270,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { Err(e) => { return Err(USimpleError::new( 1, - format!("invalid format {} ({e})", format_string), + format!("invalid format {format_string} ({e})"), )); } }, diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index fc2689448..3ab8474dd 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -745,7 +745,7 @@ impl<'a> Pager<'a> { &format!("{}{pattern}{}", Attribute::Reverse, Attribute::Reset), ); }; - self.stdout.write_all(format!("\r{}\n", line).as_bytes())?; + self.stdout.write_all(format!("\r{line}\n").as_bytes())?; lines_printed += 1; index += 1; } @@ -792,7 +792,7 @@ impl<'a> Pager<'a> { if percentage >= 100 { " (END)".to_string() } else { - format!(" ({}%)", percentage) + format!(" ({percentage}%)") } } } else { diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index f74317c39..085beadc0 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -390,7 +390,7 @@ fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> { } let eol = if options.zero_terminated { '\0' } else { '\n' }; - print!("{}", eol); + print!("{eol}"); Ok(()) } diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index e4e1c4224..f7131b319 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -81,7 +81,7 @@ impl FilterMode { 1, get_message_with_args( "tail-error-invalid-number-of-bytes", - HashMap::from([("arg".to_string(), format!("'{}'", e))]), + HashMap::from([("arg".to_string(), format!("'{e}'"))]), ), )); } diff --git a/src/uu/tr/src/operation.rs b/src/uu/tr/src/operation.rs index fde766e49..dbade6b46 100644 --- a/src/uu/tr/src/operation.rs +++ b/src/uu/tr/src/operation.rs @@ -72,7 +72,7 @@ impl Display for BadSequence { "{}", get_message_with_args( "tr-error-invalid-repeat-count", - HashMap::from([("count".to_string(), format!("'{}'", count))]) + HashMap::from([("count".to_string(), format!("'{count}'"))]) ) ) } diff --git a/src/uucore/src/lib/mods/locale.rs b/src/uucore/src/lib/mods/locale.rs index d48df652f..3bce3a3d7 100644 --- a/src/uucore/src/lib/mods/locale.rs +++ b/src/uucore/src/lib/mods/locale.rs @@ -174,8 +174,7 @@ fn create_bundle( bundle.add_resource(resource).map_err(|errs| { LocalizationError::Bundle(format!( - "Failed to add resource to bundle for {}: {:?}", - locale, errs + "Failed to add resource to bundle for {locale}: {errs:?}", )) })?; @@ -276,7 +275,7 @@ fn detect_system_locale() -> Result { .unwrap_or(DEFAULT_LOCALE) .to_string(); LanguageIdentifier::from_str(&locale_str).map_err(|_| { - LocalizationError::ParseLocale(format!("Failed to parse locale: {}", locale_str)) + LocalizationError::ParseLocale(format!("Failed to parse locale: {locale_str}")) }) }