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

@ -30,7 +30,7 @@ pub fn derive(input: syn::DeriveInput) -> quote::Tokens {
} else {
let mut sum = quote!();
sum.append_separated(this_info.iter().zip(&other_info).map(|(this, other)| {
where_clause.add_trait_bound(this.field.ty.clone());
where_clause.add_trait_bound(&this.field.ty);
quote! {
::values::distance::ComputeSquaredDistance::compute_squared_distance(#this, #other)?
}