Fix formatting of Apply nodes with zero args, which the repl generates

This commit is contained in:
Joshua Warner 2024-12-03 18:13:27 -08:00
parent 9a9b96dc69
commit f833ac9a6b
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD

View file

@ -894,6 +894,10 @@ pub fn expr_lift_spaces<'a, 'b: 'a>(
) -> Spaces<'a, Expr<'a>> {
match expr {
Expr::Apply(func, args, called_via) => {
if args.is_empty() {
return expr_lift_spaces(Parens::NotNeeded, arena, &func.value);
}
let func_lifted = expr_lift_spaces(Parens::InApply, arena, &func.value);
let args = arena.alloc_slice_copy(args);
let mut res = if let Some(last) = args.last_mut() {