Allow trailing commas inside generics
diff --git a/src/generics.rs b/src/generics.rs
index 6f89adb..99165c4 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -165,6 +165,7 @@
                     cond!(!lifetimes.is_empty(), punct!(",")),
                     separated_nonempty_list!(punct!(","), ty_param)
                 )) >>
+                cond!(!lifetimes.is_empty() || !ty_params.is_empty(), option!(punct!(","))) >>
                 punct!(">") >>
                 (lifetimes, ty_params)
             )
diff --git a/src/ty.rs b/src/ty.rs
index f9e3a2d..f52fb19 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -463,6 +463,7 @@
                 cond!(!lifetimes.is_empty() || !types.is_empty(), punct!(",")),
                 separated_nonempty_list!(punct!(","), type_binding)
             )) >>
+            cond!(!lifetimes.is_empty() || !types.is_empty() || !bindings.is_empty(), option!(punct!(","))) >>
             punct!(">") >>
             (PathSegment {
                 ident: id.unwrap_or_else(|| "".into()),