Move overly-specific check to an assertion where its relevant
authorMatt Corallo <git@bluematt.me>
Thu, 2 Jun 2022 20:40:54 +0000 (20:40 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 24 Jun 2022 21:27:19 +0000 (21:27 +0000)
c-bindings-gen/src/types.rs

index b988a7b6d563a2b60003ee869d648b856b21db83..c96a3b9a2fd51220057d89381c95e77e2f5d11a6 100644 (file)
@@ -227,12 +227,13 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
                                                                non_lifetimes_processed = true;
                                                                if path != "std::ops::Deref" && path != "core::ops::Deref" {
                                                                        new_typed_generics.insert(&type_param.ident, Some(path));
-                                                               } else if trait_bound.path.segments.len() == 1 {
+                                                               } else {
                                                                        // If we're templated on Deref<Target = ConcreteThing>, store
                                                                        // the reference type in `default_generics` which handles full
                                                                        // types and not just paths.
                                                                        if let syn::PathArguments::AngleBracketed(ref args) =
                                                                                        trait_bound.path.segments[0].arguments {
+                                                                               assert_eq!(trait_bound.path.segments.len(), 1);
                                                                                for subargument in args.args.iter() {
                                                                                        match subargument {
                                                                                                syn::GenericArgument::Lifetime(_) => {},