Format crash

This commit is contained in:
Ayaz Hafiz 2022-11-02 12:41:52 -05:00
parent fee01166c7
commit 1011ce9fba
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 43 additions and 1 deletions

View file

@ -43,7 +43,8 @@ impl<'a> Formattable for Expr<'a> {
| MalformedIdent(_, _)
| MalformedClosure
| Tag(_)
| OpaqueRef(_) => false,
| OpaqueRef(_)
| Crash => false,
// These expressions always have newlines
Defs(_, _) | When(_, _) => true,
@ -191,6 +192,10 @@ impl<'a> Formattable for Expr<'a> {
buf.push('_');
buf.push_str(name);
}
Crash => {
buf.indent(indent);
buf.push_str("crash");
}
Apply(loc_expr, loc_args, _) => {
buf.indent(indent);
if apply_needs_parens && !loc_args.is_empty() {

View file

@ -666,6 +666,7 @@ impl<'a> RemoveSpaces<'a> for Expr<'a> {
arena.alloc(a.remove_spaces(arena)),
arena.alloc(b.remove_spaces(arena)),
),
Expr::Crash => Expr::Crash,
Expr::Defs(a, b) => {
let mut defs = a.clone();
defs.space_before = vec![Default::default(); defs.len()];