mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
rust: clippy: enable uninlined_format_args lint
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7abf0d95ac
commit
c6b04613bd
4 changed files with 12 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
doc-valid-idents = ["PrimeCell", ".."]
|
||||
allow-mixed-uninlined-format-args = false
|
||||
msrv = "1.77.0"
|
||||
|
|
|
@ -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(),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -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)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue