mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-03 07:45:38 +00:00
Fix clippy warnings
This commit is contained in:
parent
4415d10c61
commit
629bf7b354
@ -65,18 +65,19 @@ where
|
|||||||
.all_fields()
|
.all_fields()
|
||||||
.flat_map(|field| {
|
.flat_map(|field| {
|
||||||
let field_ty = field.ty;
|
let field_ty = field.ty;
|
||||||
let matching_generic = |t: &syn::PathSegment, g| match g {
|
let matching_generic = |t: &syn::PathSegment, g: &syn::GenericParam| match *g {
|
||||||
&syn::GenericParam::Type(ref generic_ty)
|
syn::GenericParam::Type(ref generic_ty)
|
||||||
if generic_ty.ident == t.ident => true,
|
if generic_ty.ident == t.ident => true,
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut field_bound: Option<syn::WherePredicate> = None;
|
let mut field_bound: Option<syn::WherePredicate> = None;
|
||||||
if let &syn::Type::Path(ref ty_path) = field_ty {
|
if let syn::Type::Path(ref ty_path) = *field_ty {
|
||||||
field_bound = match (gen_bound_where(&field.attrs), ty_path.path.segments.first()) {
|
field_bound = match (gen_bound_where(&field.attrs), ty_path.path.segments.first()) {
|
||||||
(true, Some(syn::punctuated::Pair::Punctuated(ref t, _)))
|
(true, Some(syn::punctuated::Pair::Punctuated(ref t, _))) =>
|
||||||
if generics.params.iter().fold(false, |b, g| b || matching_generic(t, g))
|
if generics.params.iter().any(|g| matching_generic(t, g)) {
|
||||||
=> Some(parse_quote!(#field_ty: #trait_bound)),
|
Some(parse_quote!(#field_ty: #trait_bound))
|
||||||
|
} else {None},
|
||||||
(_, _) => None
|
(_, _) => None
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user