| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
ngl first time looking into this derive code, it is kinda weird. could just rewrite to #[proc_macro_derive(ImplicitClone)]
pub fn derive_implicit_clone(item: proc_macro::TokenStream) -> proc_macro::TokenStream {
let mut input = syn::parse_macro_input!(item as syn::DeriveInput);
input
.generics
.type_params_mut()
.for_each(|type_param| type_param.bounds.push(syn::parse_quote! { ::implicit_clone::ImplicitClone }));
let syn::DeriveInput {
ident, generics, ..
} = input;
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
let res = quote! {
impl #impl_generics ::implicit_clone::ImplicitClone for #ident #ty_generics #where_clause {}
};
res.into()
}this way we just add bounds, and rest syn will figure out on its own |
Sorry, something went wrong.
|
I'm not super familiar with writing derive macros, so I tried to change as little as necessary. I will try your implementation later and update the PR if there are no issues. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This will become an error in the future, and the defaults in impl are ignored anyway so it makes no sense to preserve them in the generated impl.