]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Allow method call args to be converted with a new_var conversion
authorMatt Corallo <git@bluematt.me>
Tue, 22 Mar 2022 23:47:22 +0000 (23:47 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 23 Mar 2022 00:59:20 +0000 (00:59 +0000)
The call was already there, not sure why we were asserting on it
not printing anything...

c-bindings-gen/src/main.rs

index cc72d29693c4305d7e30b73fe5b033af2a10fcfe..fbe3c99b64b1b9288784cd1921e280e592c9c93f 100644 (file)
@@ -111,9 +111,12 @@ fn maybe_convert_trait_impl<W: std::io::Write>(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));