aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-20 10:01:15 +0100
committerMartin Fischer <martin@push-f.com>2021-11-20 10:19:03 +0100
commit7d549f29d63df264884e80f1e95d881d7c0f7407 (patch)
tree1206e4fb69cbf1ba7ae1d5fd34979e230c6a667f /src/lib.rs
parent80225095fe224285215b83406950d53835e4dcf9 (diff)
refactor: use syn::Generics::type_params iterators
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b655778..957d424 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -178,16 +178,14 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
let mut generic_map = HashMap::new();
- for generic in &dyn_trait.generics.params {
- if let GenericParam::Type(type_param) = generic {
- generic_map.insert(type_param.ident.clone(), type_param.bounds.clone());
- for trait_bound in trait_bounds(&type_param.bounds) {
- if let Some(assoc_type) = find_in_path(&trait_bound.path, &AssocTypeMatcher) {
- return abort!(
- assoc_type.span(),
- "dynamize does not support associated types in trait generic bounds"
- );
- }
+ for type_param in dyn_trait.generics.type_params() {
+ generic_map.insert(type_param.ident.clone(), type_param.bounds.clone());
+ for trait_bound in trait_bounds(&type_param.bounds) {
+ if let Some(assoc_type) = find_in_path(&trait_bound.path, &AssocTypeMatcher) {
+ return abort!(
+ assoc_type.span(),
+ "dynamize does not support associated types in trait generic bounds"
+ );
}
}
}