Skip to content

Commit 90aaf45

Browse files
authored
Do not add block around async closure (#3946)
1 parent d5b6560 commit 90aaf45

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/closures.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ fn rewrite_closure_expr(
177177
fn allow_multi_line(expr: &ast::Expr) -> bool {
178178
match expr.kind {
179179
ast::ExprKind::Match(..)
180+
| ast::ExprKind::Async(..)
180181
| ast::ExprKind::Block(..)
181182
| ast::ExprKind::TryBlock(..)
182183
| ast::ExprKind::Loop(..)

tests/target/async_closure.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ fn main() {
1515
let x = 3;
1616
x
1717
};
18+
19+
let f = |x| async {
20+
println!("hello, world");
21+
};
1822
}

0 commit comments

Comments
 (0)