mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 19:01:02 +00:00
Make use of Generics::type_params iterator
This commit is contained in:
@@ -149,13 +149,8 @@ where
|
|||||||
fn visit_macro(&mut self, _mac: &syn::Macro) {}
|
fn visit_macro(&mut self, _mac: &syn::Macro) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let all_ty_params: HashSet<_> = generics
|
let all_ty_params = generics.type_params()
|
||||||
.params
|
.map(|param| param.ident)
|
||||||
.iter()
|
|
||||||
.filter_map(|param| match *param {
|
|
||||||
syn::GenericParam::Type(ref param) => Some(param.ident),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut visitor = FindTyParams {
|
let mut visitor = FindTyParams {
|
||||||
@@ -179,13 +174,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_predicates = generics
|
let new_predicates = generics.type_params()
|
||||||
.params
|
.map(|param| param.ident)
|
||||||
.iter()
|
|
||||||
.filter_map(|param| match *param {
|
|
||||||
syn::GenericParam::Type(ref param) => Some(param.ident),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.filter(|id| visitor.relevant_ty_params.contains(id))
|
.filter(|id| visitor.relevant_ty_params.contains(id))
|
||||||
.map(|id| {
|
.map(|id| {
|
||||||
syn::WherePredicate::Type(syn::PredicateType {
|
syn::WherePredicate::Type(syn::PredicateType {
|
||||||
|
|||||||
Reference in New Issue
Block a user