diff options
Diffstat (limited to 'macros/src/syn_ext.rs')
-rw-r--r-- | macros/src/syn_ext.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/macros/src/syn_ext.rs b/macros/src/syn_ext.rs index 7a3e9ae..9b5b037 100644 --- a/macros/src/syn_ext.rs +++ b/macros/src/syn_ext.rs @@ -27,15 +27,28 @@ use syn::{ pub trait GenericsExt: Sized { - fn without_where_clause(self) -> Self; + fn strip_where_clause_and_bounds(self) -> Self; } impl GenericsExt for Generics { - fn without_where_clause(mut self) -> Self + fn strip_where_clause_and_bounds(mut self) -> Self { self.where_clause = None; + self.params = self + .params + .into_iter() + .map(|generic_param| match generic_param { + GenericParam::Type(mut type_param) => { + type_param.bounds.clear(); + + GenericParam::Type(type_param) + } + generic_param => generic_param, + }) + .collect(); + self } } |