From 550e354c720271341c34c0dc02599cba5046d047 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 2 Jun 2022 20:40:54 +0000 Subject: [PATCH] Move overly-specific check to an assertion where its relevant --- c-bindings-gen/src/types.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 5985521..16cc067 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -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, 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(_) => {}, -- 2.39.5