Move associated type search into with_bounds

This commit is contained in:
David Tolnay
2018-04-12 22:39:26 -07:00
parent f06001c086
commit 24700ebeb6
3 changed files with 43 additions and 60 deletions
+3 -9
View File
@@ -130,14 +130,8 @@ impl Parameters {
fn build_generics(cont: &Container) -> syn::Generics {
let generics = bound::without_defaults(cont.generics);
let trait_bound = parse_quote!(_serde::Serialize);
let generics = bound::with_where_predicates_from_fields(
cont,
&generics,
&trait_bound,
attr::Field::ser_bound,
|field| field.serialize_with().is_none() && !field.skip_serializing()
);
let generics =
bound::with_where_predicates_from_fields(cont, &generics, attr::Field::ser_bound);
match cont.attrs.ser_bound() {
Some(predicates) => bound::with_where_predicates(&generics, predicates),
@@ -145,7 +139,7 @@ fn build_generics(cont: &Container) -> syn::Generics {
cont,
&generics,
needs_serialize_bound,
&trait_bound
&parse_quote!(_serde::Serialize),
),
}
}