diff --git a/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs b/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs index cf08c7e..eefa8be 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs @@ -584,7 +584,7 @@ impl ToTokens for ParsedBundle { |((index, field), flip)| { let ident: &Ident = field.ident().as_ref().unwrap(); let ident_str = ident.to_string(); - let flipped = flip.is_some(); + let not_flipped = flip.is_none().then(|| Token![!](span)); quote_spanned! {span=> #ident: { let ::fayalite::bundle::BundleField { @@ -593,7 +593,7 @@ impl ToTokens for ParsedBundle { ty: __ty, } = #fields_token[#index]; ::fayalite::__std::assert_eq!(&*__name, #ident_str); - ::fayalite::__std::assert_eq!(__flipped, #flipped); + ::fayalite::__std::assert!(#not_flipped __flipped); ::fayalite::ty::Type::from_canonical(__ty) }, } diff --git a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs index e36f68e..b6ab88d 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs @@ -66,6 +66,7 @@ impl Drop for WrappedInConst<'_> { fn drop(&mut self) { let inner = &self.inner; quote_spanned! {self.span=> + #[allow(clippy::type_complexity)] const _: () = { #inner }; diff --git a/crates/fayalite-proc-macros-impl/src/module.rs b/crates/fayalite-proc-macros-impl/src/module.rs index 6363bb3..0852f58 100644 --- a/crates/fayalite-proc-macros-impl/src/module.rs +++ b/crates/fayalite-proc-macros-impl/src/module.rs @@ -450,12 +450,21 @@ impl ModuleFn { let fn_name_str = fn_name.to_string(); let (_, body_type_generics, _) = body_fn.sig.generics.split_for_impl(); let body_turbofish_type_generics = body_type_generics.as_turbofish(); + let body_lambda = if param_names.is_empty() { + quote! { + __body #body_turbofish_type_generics + } + } else { + quote! { + |m| __body #body_turbofish_type_generics(m, #(#param_names,)*) + } + }; let block = parse_quote! {{ #body_fn ::fayalite::module::ModuleBuilder::run( #fn_name_str, #module_kind_value, - |m| __body #body_turbofish_type_generics(m, #(#param_names,)*), + #body_lambda, ) }}; let outer_fn = ItemFn {