parent
efa31e3df7
commit
cc18e7cff2
|
@ -569,7 +569,7 @@ impl<'comments> Formatter<'comments> {
|
||||||
) -> Document<'a> {
|
) -> Document<'a> {
|
||||||
let args = wrap_args(args.iter().map(|e| (self.fn_arg(e), false))).group();
|
let args = wrap_args(args.iter().map(|e| (self.fn_arg(e), false))).group();
|
||||||
let body = match body {
|
let body = match body {
|
||||||
UntypedExpr::When { .. } => self.expr(body).force_break(),
|
UntypedExpr::Trace { .. } | UntypedExpr::When { .. } => self.expr(body).force_break(),
|
||||||
_ => self.expr(body),
|
_ => self.expr(body),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -698,3 +698,28 @@ fn weird_comments() {
|
||||||
|
|
||||||
assert_fmt(src, expected);
|
assert_fmt(src, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn format_trace_callback() {
|
||||||
|
let src = indoc! { r#"
|
||||||
|
fn foo() {
|
||||||
|
list.any([], fn (e) { trace @"foo"
|
||||||
|
e
|
||||||
|
})
|
||||||
|
}
|
||||||
|
"#};
|
||||||
|
|
||||||
|
let expected = indoc! { r#"
|
||||||
|
fn foo() {
|
||||||
|
list.any(
|
||||||
|
[],
|
||||||
|
fn(e) {
|
||||||
|
trace @"foo"
|
||||||
|
e
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
"#};
|
||||||
|
|
||||||
|
assert_fmt(src, expected);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue