From 3553b02644cf80a7fd69789652f62ee1915b5f9f Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 29 Apr 2025 17:20:11 +0100 Subject: [PATCH] Fix clippy not linting logging format args --- src/game.rs | 6 +++--- src/logging.rs | 6 ++++++ src/sorting/groups.rs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/game.rs b/src/game.rs index 8ec5923a..c70d5a3e 100644 --- a/src/game.rs +++ b/src/game.rs @@ -390,7 +390,7 @@ impl Game { self.cache.set_archive_paths(archive_paths); - logging::trace!("Starting loading {}s.", load_scope); + logging::trace!("Starting loading {load_scope}s."); let plugins: Vec<_> = plugin_paths .par_iter() @@ -462,7 +462,7 @@ impl Game { if is_log_enabled(LogLevel::Debug) { logging::debug!("Current load order:"); for plugin_name in plugin_names { - logging::debug!("\t{}", plugin_name); + logging::debug!("\t{plugin_name}"); } } @@ -477,7 +477,7 @@ impl Game { if is_log_enabled(LogLevel::Debug) { logging::debug!("Sorted load order:"); for plugin_name in &new_load_order { - logging::debug!("\t{}", plugin_name); + logging::debug!("\t{plugin_name}"); } } diff --git a/src/logging.rs b/src/logging.rs index f444c29f..b0023491 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -105,6 +105,7 @@ impl Logger { } } +#[clippy::format_args] macro_rules! log { ($level:expr, $($arg:tt)+) => { // Log using the Rust log crate, as it's probably good to support that. @@ -123,22 +124,27 @@ macro_rules! log { }; } +#[clippy::format_args] macro_rules! error { ($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Error, $($arg)+) }; } +#[clippy::format_args] macro_rules! warning { ($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Warning, $($arg)+) }; } +#[clippy::format_args] macro_rules! info { ($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Info, $($arg)+) }; } +#[clippy::format_args] macro_rules! debug { ($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Debug, $($arg)+) }; } +#[clippy::format_args] macro_rules! trace { ($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Trace, $($arg)+) }; } diff --git a/src/sorting/groups.rs b/src/sorting/groups.rs index d152a334..25f5c992 100644 --- a/src/sorting/groups.rs +++ b/src/sorting/groups.rs @@ -197,7 +197,7 @@ fn find_node_by_weight( { Ok(n) } else { - logging::error!("Can't find group with name {}", weight); + logging::error!("Can't find group with name {weight}"); Err(UndefinedGroupError::new(weight.to_owned())) } }