Improve handling of trait bounds when deriving fmap-like traits

This commit is contained in:
Anthony Ramine 2017-08-26 12:40:28 +02:00
parent 8101887d31
commit efc852f6e3
12 changed files with 229 additions and 136 deletions

View file

@ -21,7 +21,7 @@ pub fn derive(input: syn::DeriveInput) -> quote::Tokens {
let mut expr = if !bindings.is_empty() {
let mut expr = quote! {};
for binding in bindings {
where_clause.add_trait_bound(binding.field.ty.clone());
where_clause.add_trait_bound(&binding.field.ty);
expr = quote! {
#expr
writer.item(#binding)?;