From 881edcf972ef61892b191a16942f93e76e28f7f6 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 b988a7b..c96a3b9 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.30.2