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 { } else {
writeln!( writeln!(
code, code,
"{}if let Some(({},)) = {}(ctx, {}) {{", "{indent}if let Some({open_paren}{vars}{close_paren}) = {name}(ctx, {args}) {{",
indent, indent = indent,
output_binders.join(", "), open_paren = if output_binders.len() == 1 { "" } else { "(" },
sig.full_name, vars = output_binders.join(", "),
input_values.join(", "), close_paren = if output_binders.len() == 1 { "" } else { ")" },
name = sig.full_name,
args = input_values.join(", "),
) )
.unwrap(); .unwrap();
false false