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>
Tue, 28 Jun 2022 17:16:28 +0000 (17:16 +0000)
c-bindings-gen/src/types.rs

index 598552102f3691ba9f50839ad1e6cda673700e54..16cc067fa21cc50b74c84cdf773322af62b6d2bc 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(_) => {},