From: Matt Corallo Date: Tue, 25 Apr 2023 22:13:38 +0000 (+0000) Subject: Ensure an option always unwraps to a non-reference type X-Git-Tag: v0.0.115.0^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=e1dd5fa811b8fecf0e0abdd6c7280a94489cc7b9 Ensure an option always unwraps to a non-reference type --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 8cc7d1e..f47bf9e 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1624,7 +1624,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { let inner_name = self.get_c_mangled_container_type(vec![single_contained.unwrap()], generics, "Option").unwrap(); return Some(("if ", vec![ (format!(".is_none() {{ {}::None }} else {{ {}::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */", inner_name, inner_name), - format!("{}.clone().unwrap()", var_access)) + format!("(*{}.as_ref().unwrap()).clone()", var_access)) ], ") }", ContainerPrefixLocation::PerConv)); } } else {