Fix formatting of function expressions with traces

Fixes #471
This commit is contained in:
KtorZ
2023-03-30 09:21:46 +02:00
parent efa31e3df7
commit cc18e7cff2
2 changed files with 26 additions and 1 deletions

View File

@@ -698,3 +698,28 @@ fn weird_comments() {
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);
}