[PATCH 1/2] rust/qemu-api-macros: normalize TryInto output

Manos Pitsidianakis posted 2 patches 1 year, 1 month ago
Maintainers: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
[PATCH 1/2] rust/qemu-api-macros: normalize TryInto output
Posted by Manos Pitsidianakis 1 year, 1 month ago
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>
---
 rust/qemu-api-macros/src/lib.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/qemu-api-macros/src/lib.rs b/rust/qemu-api-macros/src/lib.rs
index c18bb4e036f4e7737f9b95ac300b7d1e8742ef1f..4b30bea9eafc7924bf593113c3f42c5b1010c4b9 100644
--- a/rust/qemu-api-macros/src/lib.rs
+++ b/rust/qemu-api-macros/src/lib.rs
@@ -201,7 +201,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),
@@ -229,7 +229,7 @@ pub const fn from_bits(value: #repr) -> Self {
                     #body
                 }) {
                     Ok(x) => x,
-                    Err(_) => panic!(#errmsg)
+                    Err(_) => panic!(#errmsg),
                 }
             }
         }

-- 
2.47.2
Re: [PATCH 1/2] rust/qemu-api-macros: normalize TryInto output
Posted by Zhao Liu 1 year, 1 month ago
On Fri, Jul 04, 2025 at 01:26:57PM +0300, Manos Pitsidianakis wrote:
> Date: Fri, 04 Jul 2025 13:26:57 +0300
> From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> Subject: [PATCH 1/2] rust/qemu-api-macros: normalize TryInto output
> X-Mailer: b4 0.14.2
> 
> 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>
> ---
>  rust/qemu-api-macros/src/lib.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>