Emit if lets against Option<x> instead of Option<(x,)>

This commit is contained in:
Nick Fitzgerald
2021-10-22 14:37:43 -07:00
committed by Chris Fallin
parent 0c6956376b
commit 7fab7c5eab

View File

@@ -575,11 +575,13 @@ impl<'a> Codegen<'a> {
} else {
writeln!(
code,
"{}if let Some(({},)) = {}(ctx, {}) {{",
indent,
output_binders.join(", "),
sig.full_name,
input_values.join(", "),
"{indent}if let Some({open_paren}{vars}{close_paren}) = {name}(ctx, {args}) {{",
indent = indent,
open_paren = if output_binders.len() == 1 { "" } else { "(" },
vars = output_binders.join(", "),
close_paren = if output_binders.len() == 1 { "" } else { ")" },
name = sig.full_name,
args = input_values.join(", "),
)
.unwrap();
false