From e0f978fbb6b9ce19876489d0bbe5fcdae57175a3 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 27 Mar 2025 23:17:28 -0700 Subject: [PATCH] silence unused `m` variable warning in #[hdl_module] with an empty body. --- crates/fayalite-proc-macros-impl/src/module.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/fayalite-proc-macros-impl/src/module.rs b/crates/fayalite-proc-macros-impl/src/module.rs index 0852f58..62b7837 100644 --- a/crates/fayalite-proc-macros-impl/src/module.rs +++ b/crates/fayalite-proc-macros-impl/src/module.rs @@ -377,7 +377,7 @@ impl ModuleFn { module_kind, vis, sig, - block, + mut block, struct_generics, the_struct, } = match self.0 { @@ -439,6 +439,12 @@ impl ModuleFn { body_sig .inputs .insert(0, parse_quote! { m: &::fayalite::module::ModuleBuilder }); + block.stmts.insert( + 0, + parse_quote! { + let _ = m; + }, + ); let body_fn = ItemFn { attrs: vec![], vis: Visibility::Inherited,