1use quote::quote;
11use syn::parse_macro_input;
12use syn::DeriveInput;
13
14use crate::util::duplicate_impl;
15
16pub fn derive_clone_(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
17 let input = parse_macro_input!(input as DeriveInput);
18 let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
19
20 let name = &input.ident;
21 let body = duplicate_impl(&input.data, "e! { ::std::clone::Clone::clone });
22 let gen = quote! {
23 #[allow(unknown_lints)]
26 #[allow(clippy::incorrect_clone_impl_on_copy_type)]
27 impl #impl_generics ::std::clone::Clone for #name #ty_generics #where_clause {
28 fn clone(&self) -> Self {
29 #body
30 }
31 }
32 };
33 gen.into()
34}