fix clippy lints in generated code
All checks were successful
/ test (push) Successful in 37m34s

This commit is contained in:
Jacob Lifshay 2024-10-07 21:59:50 -07:00
parent 017c14a2f1
commit 99180eb3b4
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c
3 changed files with 13 additions and 3 deletions

View file

@ -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)
},
}

View file

@ -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
};

View file

@ -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 {