From: Matt Corallo Date: Tue, 22 Mar 2022 23:47:22 +0000 (+0000) Subject: Allow method call args to be converted with a new_var conversion X-Git-Tag: v0.0.105.2~1^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=cab2cade9d05757b5297905aab111cdf29390b68;p=ldk-c-bindings Allow method call args to be converted with a new_var conversion The call was already there, not sure why we were asserting on it not printing anything... --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index cc72d29..fbe3c99 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -111,9 +111,12 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path if let syn::GenericArgument::Type(args_ty) = args.args.iter().next().unwrap() { types.write_c_type(w, args_ty, Some(generics), false); - assert!(!types.write_from_c_conversion_new_var(&mut arg_conv, &format_ident!("arg"), &args_ty, Some(generics))); + write!(&mut arg_conv, "\t").unwrap(); + if types.write_from_c_conversion_new_var(&mut arg_conv, &format_ident!("arg"), &args_ty, Some(generics)) { + write!(&mut arg_conv, "\n\t").unwrap(); + } - write!(&mut arg_conv, "\tlet arg_conv = ").unwrap(); + write!(&mut arg_conv, "let arg_conv = ").unwrap(); types.write_from_c_conversion_prefix(&mut arg_conv, &args_ty, Some(generics)); write!(&mut arg_conv, "arg").unwrap(); types.write_from_c_conversion_suffix(&mut arg_conv, &args_ty, Some(generics));