rust/qemu-api-macros: normalize TryInto output

Remove extraneous `;` and add missing trailing comma to TryInto derive
macro to match rustfmt style. We will add a test in the followup commit
and we would like the inlined output in the test body to be properly
formatted as well.

No functional changes intended.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250704-rust_add_derive_macro_unit_tests-v1-1-ebd47fa7f78f@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Manos Pitsidianakis
2025-07-10 18:33:51 +02:00
committed by Paolo Bonzini
parent dab63b8a71
commit c3a08c8dcb
+2 -2
View File
@@ -199,7 +199,7 @@ fn derive_tryinto_body(
let discriminants: Vec<&Ident> = variants.iter().map(|f| &f.ident).collect();
Ok(quote! {
#(const #discriminants: #repr = #name::#discriminants as #repr;)*;
#(const #discriminants: #repr = #name::#discriminants as #repr;)*
match value {
#(#discriminants => core::result::Result::Ok(#name::#discriminants),)*
_ => core::result::Result::Err(value),
@@ -227,7 +227,7 @@ fn derive_tryinto_or_error(input: DeriveInput) -> Result<proc_macro2::TokenStrea
#body
}) {
Ok(x) => x,
Err(_) => panic!(#errmsg)
Err(_) => panic!(#errmsg),
}
}
}