mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Refactor how we handle trait bounds in style_derive
For the traits we derive which methods don't depend on associated types (i.e. all of them but ToAnimatedValue and ToComputedValue), we now add trait bounds for the actual field types directly, instead of bounding the type parameters.
This commit is contained in:
parent
13d47ba69a
commit
04ad28b564
8 changed files with 75 additions and 58 deletions
|
@ -30,9 +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.predicates.push(
|
||||
cg::where_predicate(this.field.ty.clone(), trait_path),
|
||||
);
|
||||
where_clause.add_trait_bound(this.field.ty.clone());
|
||||
quote! {
|
||||
::values::distance::ComputeSquaredDistance::compute_squared_distance(#this, #other)?
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue