display: newline-indent bare function bodies(?)
This commit is contained in:
@@ -41,7 +41,7 @@ impl<A: Annotation> Display for Expr<A> {
|
||||
Self::Op(Op::Tuple, exprs) => f.delimit("(", ")").list(exprs, ", "),
|
||||
Self::Op(Op::Group, exprs) => f.list(exprs, ", "),
|
||||
Self::Op(Op::Meta, exprs) => match exprs.as_slice() {
|
||||
[meta, expr @ ..] => f.delimit(fmt!("#[{meta}]\n"), "").list(expr, ","),
|
||||
[meta, expr @ ..] => f.delimit(fmt!("#[{meta}] "), "").list(expr, ","),
|
||||
[] => write!(f, "#[]"),
|
||||
},
|
||||
|
||||
@@ -182,7 +182,13 @@ impl<A: Annotation> Display for Bind<A> {
|
||||
match op {
|
||||
BindOp::Match => f.delimit(fmt!("{pat} => "), "").list(exprs, ",!? "),
|
||||
BindOp::Fn | BindOp::Mod | BindOp::Impl => {
|
||||
if let [Anno(Expr::Op(Op::Block, _), _)] = exprs.as_slice() {
|
||||
f.delimit(fmt!("{pat} "), "").list(exprs, ",!? ")
|
||||
} else {
|
||||
// wrap bare function bodies to new line
|
||||
f.delimit_indented(pat, "")
|
||||
.list_wrap("\n", exprs, ",!?", "")
|
||||
}
|
||||
}
|
||||
BindOp::Struct | BindOp::Enum => match pat {
|
||||
Pat::NamedRecord(name, bind) => match bind.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user