mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
formatter: refactor fmt_collection to receive enum for braces type
This commit is contained in:
parent
5baf1ac8b3
commit
4981f081a7
4 changed files with 56 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::annotation::{Formattable, Newlines, Parens};
|
||||
use crate::collection::fmt_collection;
|
||||
use crate::collection::{fmt_collection, Braces};
|
||||
use crate::def::fmt_def;
|
||||
use crate::pattern::fmt_pattern;
|
||||
use crate::spaces::{count_leading_newlines, fmt_comments_only, fmt_spaces, NewlineAt, INDENT};
|
||||
|
@ -353,7 +353,7 @@ impl<'a> Formattable for Expr<'a> {
|
|||
fmt_if(buf, branches, final_else, self.is_multiline(), indent);
|
||||
}
|
||||
When(loc_condition, branches) => fmt_when(buf, loc_condition, branches, indent),
|
||||
List(items) => fmt_collection(buf, indent, '[', ']', *items, Newlines::No),
|
||||
List(items) => fmt_collection(buf, indent, Braces::Square, *items, Newlines::No),
|
||||
BinOps(lefts, right) => fmt_bin_ops(buf, lefts, right, false, parens, indent),
|
||||
UnaryOp(sub_expr, unary_op) => {
|
||||
buf.indent(indent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue