From 6987de828c46b22156b071c24ff8b67c1d115f9d Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 20 Feb 2025 21:48:17 -0500 Subject: [PATCH] Mark all format-like macros for Clippy See https://doc.rust-lang.org/nightly/clippy/attribs.html#clippyformat_args --- api/node/rust/lib.rs | 1 + internal/core/string.rs | 1 + internal/core/tests.rs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/node/rust/lib.rs b/api/node/rust/lib.rs index 8270b5aca56..0a735c8bebb 100644 --- a/api/node/rust/lib.rs +++ b/api/node/rust/lib.rs @@ -131,6 +131,7 @@ pub fn print_to_console(env: Env, function: &str, arguments: core::fmt::Argument } #[macro_export] +#[clippy::format_args] macro_rules! console_err { ($env:expr, $($t:tt)*) => ($crate::print_to_console($env, "error", format_args!($($t)*))) } diff --git a/internal/core/string.rs b/internal/core/string.rs index 6fd25d0ef31..68057ab0efd 100644 --- a/internal/core/string.rs +++ b/internal/core/string.rs @@ -19,6 +19,7 @@ use core::ops::Deref; /// assert_eq!(s, slint::SharedString::from("Hello world")); /// ``` #[macro_export] +#[clippy::format_args] macro_rules! format { ($($arg:tt)*) => {{ $crate::string::format(core::format_args!($($arg)*)) diff --git a/internal/core/tests.rs b/internal/core/tests.rs index 8619fd30287..98c558d5f14 100644 --- a/internal/core/tests.rs +++ b/internal/core/tests.rs @@ -117,9 +117,10 @@ pub fn default_debug_log(_arguments: core::fmt::Arguments) { } } -#[macro_export] /// This macro allows producing debug output that will appear on stderr in regular builds /// and in the console log for wasm builds. +#[macro_export] +#[clippy::format_args] macro_rules! debug_log { ($($t:tt)*) => ($crate::tests::debug_log_impl(format_args!($($t)*))) }