* [PATCH] rust: clippy: enable uninlined_format_args lint
@ 2025-05-05 16:51 Paolo Bonzini
0 siblings, 0 replies; only message in thread
From: Paolo Bonzini @ 2025-05-05 16:51 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-05 16:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-05 16:51 [PATCH] rust: clippy: enable uninlined_format_args lint Paolo Bonzini
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).