ast: formatting; main: explicit verbosity

This commit is contained in:
2025-10-17 06:57:21 -04:00
parent f05d480b35
commit db9c75b3c6
3 changed files with 11 additions and 6 deletions

View File

@@ -438,7 +438,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, "#[]"),
},
@@ -465,7 +465,7 @@ impl<A: Annotation> Display for Expr<A> {
impl Display for Op {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Op::Do => "; ",
Op::Do => ";\n",
Op::As => " as ",
Op::Macro => "macro ",
Op::Block => "{}",
@@ -550,7 +550,7 @@ impl Display for Pat {
Self::Name(name) => name.fmt(f),
Self::Path(path) => path.fmt(f),
Self::Struct(name, bind) => match bind.as_ref() {
Pat::Op(PatOp::Tuple, parts) => f.delimit(fmt!("{name} {{"), "}").list(parts, ", "),
Pat::Op(PatOp::Tuple, parts) => f.delimit(fmt!("{name} {{ "), " }").list(parts, ", "),
other => write!(f, "{name} {{ {other} }}"),
},
Self::TupStruct(name, bind) => write!(f, "{name} {bind}"),