From cab2cade9d05757b5297905aab111cdf29390b68 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 22 Mar 2022 23:47:22 +0000 Subject: [PATCH] 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... --- c-bindings-gen/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)); -- 2.39.5