Fixed the multiline dbg formatting

This commit is contained in:
ptaszor3 2023-12-10 18:43:27 +01:00
parent 6a6d5cebc0
commit 7162fbddd3
No known key found for this signature in database
GPG key ID: 083F32091F5D7CEE
3 changed files with 11 additions and 23 deletions

View file

@ -305,22 +305,16 @@ fn should_outdent(mut rhs: &TypeAnnotation) -> bool {
fn fmt_dbg_in_def<'a>(
buf: &mut Buf,
condition: &'a Loc<Expr<'a>>,
is_multiline: bool,
_: bool,
indent: u16,
) {
buf.ensure_ends_with_newline();
buf.indent(indent);
buf.push_str("dbg");
let return_indent = if is_multiline {
buf.newline();
indent + INDENT
} else {
buf.spaces(1);
indent
};
buf.spaces(1);
condition.format(buf, return_indent);
condition.format(buf, indent);
}
fn fmt_expect<'a>(buf: &mut Buf, condition: &'a Loc<Expr<'a>>, is_multiline: bool, indent: u16) {

View file

@ -956,22 +956,17 @@ fn fmt_dbg<'a>(
buf: &mut Buf,
condition: &'a Loc<Expr<'a>>,
continuation: &'a Loc<Expr<'a>>,
is_multiline: bool,
_: bool,
indent: u16,
) {
buf.ensure_ends_with_newline();
buf.indent(indent);
buf.push_str("dbg");
let return_indent = if is_multiline {
buf.newline();
indent + INDENT
} else {
buf.spaces(1);
indent
};
buf.spaces(1);
condition.format(buf, return_indent);
condition.format(buf, indent);
// Always put a blank line after the `dbg` line(s)
buf.ensure_ends_with_blank_line();

View file

@ -1,7 +1,6 @@
dbg
(
5,
666,
)
dbg (
5,
666,
)
4