From 7fab7c5eab1033e99e444a2ed12953d572e53044 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 22 Oct 2021 14:37:43 -0700 Subject: [PATCH] Emit `if let`s against `Option` instead of `Option<(x,)>` --- cranelift/isle/isle/src/codegen.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cranelift/isle/isle/src/codegen.rs b/cranelift/isle/isle/src/codegen.rs index 1b63ea3fc9..844d5c8b49 100644 --- a/cranelift/isle/isle/src/codegen.rs +++ b/cranelift/isle/isle/src/codegen.rs @@ -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