mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
Don't wrap 1-tuples in parens
This commit is contained in:
parent
7ded31cbc3
commit
8369e376b0
@ -1570,7 +1570,29 @@ fn tag_union_struct_help<'a, I: Iterator<Item = &'a (L, TypeId)>, L: Display + P
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
);
|
||||
let owned_ret = {
|
||||
let owned_ret;
|
||||
let borrowed_ret;
|
||||
let owned_ret_type;
|
||||
let borrowed_ret_type;
|
||||
|
||||
if ret_types.len() == 1 {
|
||||
owned_ret_type = ret_types.join("");
|
||||
borrowed_ret_type = owned_ret_type.clone();
|
||||
|
||||
let ret_val = ret_values.first().unwrap();
|
||||
owned_ret = format!("\n{INDENT}{INDENT}{ret_val}");
|
||||
borrowed_ret = format!("\n{INDENT}{INDENT}&{ret_val}");
|
||||
} else {
|
||||
owned_ret_type = format!("({})", ret_types.join(", "));
|
||||
borrowed_ret_type = format!(
|
||||
"({})",
|
||||
ret_types
|
||||
.iter()
|
||||
.map(|ret_type| { format!("&{ret_type}") })
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ")
|
||||
);
|
||||
owned_ret = {
|
||||
let lines = ret_values
|
||||
.iter()
|
||||
.map(|line| format!("\n{INDENT}{INDENT}{INDENT}{line}"))
|
||||
@ -1579,7 +1601,7 @@ fn tag_union_struct_help<'a, I: Iterator<Item = &'a (L, TypeId)>, L: Display + P
|
||||
|
||||
format!("({lines}\n{INDENT}{INDENT})")
|
||||
};
|
||||
let borrowed_ret = {
|
||||
borrowed_ret = {
|
||||
let lines = ret_values
|
||||
.iter()
|
||||
.map(|line| format!("\n{INDENT}{INDENT}{INDENT}&{line}"))
|
||||
@ -1588,15 +1610,7 @@ fn tag_union_struct_help<'a, I: Iterator<Item = &'a (L, TypeId)>, L: Display + P
|
||||
|
||||
format!("({lines}\n{INDENT}{INDENT})")
|
||||
};
|
||||
let owned_ret_type = format!("({})", ret_types.join(", "));
|
||||
let borrowed_ret_type = format!(
|
||||
"({})",
|
||||
ret_types
|
||||
.iter()
|
||||
.map(|ret_type| { format!("&{ret_type}") })
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ")
|
||||
);
|
||||
}
|
||||
|
||||
StructIngredients {
|
||||
payload_args,
|
||||
|
Loading…
Reference in New Issue
Block a user