qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH] rust: clippy: enable uninlined_format_args lint
Date: Mon,  5 May 2025 18:51:05 +0200	[thread overview]
Message-ID: <20250505165105.145180-1-pbonzini@redhat.com> (raw)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/Cargo.toml                 |  1 +
 rust/clippy.toml                |  1 +
 rust/qemu-api-macros/src/lib.rs | 16 ++++++++--------
 rust/qemu-api/build.rs          |  4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 4f6fe17b50f..d9faeecb10b 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -89,6 +89,7 @@ suspicious_operation_groupings = "deny"
 transmute_ptr_to_ptr = "deny"
 transmute_undefined_repr = "deny"
 type_repetition_in_bounds = "deny"
+uninlined_format_args = "deny"
 used_underscore_binding = "deny"
 
 # nice to have, but cannot be enabled yet
diff --git a/rust/clippy.toml b/rust/clippy.toml
index 933e46a2ffb..58a62c0e632 100644
--- a/rust/clippy.toml
+++ b/rust/clippy.toml
@@ -1,2 +1,3 @@
 doc-valid-idents = ["PrimeCell", ".."]
+allow-mixed-uninlined-format-args = false
 msrv = "1.77.0"
diff --git a/rust/qemu-api-macros/src/lib.rs b/rust/qemu-api-macros/src/lib.rs
index dc14cac4ffa..f97449bb304 100644
--- a/rust/qemu-api-macros/src/lib.rs
+++ b/rust/qemu-api-macros/src/lib.rs
@@ -18,13 +18,13 @@ fn get_fields<'a>(
 ) -> Result<&'a Punctuated<Field, Comma>, MacroError> {
     let Data::Struct(ref s) = &input.data else {
         return Err(MacroError::Message(
-            format!("Struct required for {}", msg),
+            format!("Struct required for {msg}"),
             input.ident.span(),
         ));
     };
     let Fields::Named(ref fs) = &s.fields else {
         return Err(MacroError::Message(
-            format!("Named fields required for {}", msg),
+            format!("Named fields required for {msg}"),
             input.ident.span(),
         ));
     };
@@ -34,19 +34,19 @@ fn get_fields<'a>(
 fn get_unnamed_field<'a>(input: &'a DeriveInput, msg: &str) -> Result<&'a Field, MacroError> {
     let Data::Struct(ref s) = &input.data else {
         return Err(MacroError::Message(
-            format!("Struct required for {}", msg),
+            format!("Struct required for {msg}"),
             input.ident.span(),
         ));
     };
     let Fields::Unnamed(FieldsUnnamed { ref unnamed, .. }) = &s.fields else {
         return Err(MacroError::Message(
-            format!("Tuple struct required for {}", msg),
+            format!("Tuple struct required for {msg}"),
             s.fields.span(),
         ));
     };
     if unnamed.len() != 1 {
         return Err(MacroError::Message(
-            format!("A single field is required for {}", msg),
+            format!("A single field is required for {msg}"),
             s.fields.span(),
         ));
     }
@@ -60,7 +60,7 @@ fn is_c_repr(input: &DeriveInput, msg: &str) -> Result<(), MacroError> {
         Ok(())
     } else {
         Err(MacroError::Message(
-            format!("#[repr(C)] required for {}", msg),
+            format!("#[repr(C)] required for {msg}"),
             input.ident.span(),
         ))
     }
@@ -73,7 +73,7 @@ fn is_transparent_repr(input: &DeriveInput, msg: &str) -> Result<(), MacroError>
         Ok(())
     } else {
         Err(MacroError::Message(
-            format!("#[repr(transparent)] required for {}", msg),
+            format!("#[repr(transparent)] required for {msg}"),
             input.ident.span(),
         ))
     }
@@ -168,7 +168,7 @@ fn get_repr_uN(input: &DeriveInput, msg: &str) -> Result<Path, MacroError> {
     }
 
     Err(MacroError::Message(
-        format!("#[repr(u8/u16/u32/u64) required for {}", msg),
+        format!("#[repr(u8/u16/u32/u64) required for {msg}"),
         input.ident.span(),
     ))
 }
diff --git a/rust/qemu-api/build.rs b/rust/qemu-api/build.rs
index 470be2a4d54..1e720641d2b 100644
--- a/rust/qemu-api/build.rs
+++ b/rust/qemu-api/build.rs
@@ -14,7 +14,7 @@ fn main() -> Result<()> {
     let path = env::var("MESON_BUILD_ROOT")
         .unwrap_or_else(|_| format!("{}/src", env!("CARGO_MANIFEST_DIR")));
 
-    let file = format!("{}/bindings.inc.rs", path);
+    let file = format!("{path}/bindings.inc.rs");
     let file = Path::new(&file);
     if !Path::new(&file).exists() {
         panic!(concat!(
@@ -29,7 +29,7 @@ fn main() -> Result<()> {
     }
 
     let out_dir = env::var("OUT_DIR").unwrap();
-    let dest_path = format!("{}/bindings.inc.rs", out_dir);
+    let dest_path = format!("{out_dir}/bindings.inc.rs");
     let dest_path = Path::new(&dest_path);
     if dest_path.symlink_metadata().is_ok() {
         remove_file(dest_path)?;
-- 
2.49.0



                 reply	other threads:[~2025-05-05 16:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250505165105.145180-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).