Define the type of the closure
Rust could not infere the type of the closure here. So we need to define
it otherwise rust could not compile it.
@@ -249,7 +249,7 @@ impl<'a> Formatter<'a> {
Constant::String { value, .. } => value.clone().to_doc().surround("\"", "\""),
Constant::List { elements, .. } => {
- let comma = if elements.iter().all(|e| e.is_simple()) {
+ let comma: fn() -> Document = if elements.iter().all(|e| e.is_simple()) {
|| delim(",").flex_break()
} else {
|| delim(",")
@@ -1095,7 +1095,8 @@ impl<'a> Formatter<'a> {
fn list_cons(&mut self, head: &UntypedExpr, tail: &UntypedExpr) -> Document {
let (elems, tail) = list_cons(head, tail, categorise_list_expr);
- let comma = if tail.is_none() && elems.iter().all(|e| e.is_simple_constant()) {
+ let comma: fn() -> Document =
+ if tail.is_none() && elems.iter().all(|e| e.is_simple_constant()) {
|| delim(",").flex_break()
} else {
|| delim(",")
