Skip to content

Commit

Permalink
Do not add block around async closure (#3946)
Browse files Browse the repository at this point in the history
  • Loading branch information
topecongiro committed Dec 2, 2019
1 parent e47aae7 commit 731f155
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/closures.rs
Expand Up @@ -170,6 +170,7 @@ fn rewrite_closure_expr(
fn allow_multi_line(expr: &ast::Expr) -> bool {
match expr.kind {
ast::ExprKind::Match(..)
| ast::ExprKind::Async(..)
| ast::ExprKind::Block(..)
| ast::ExprKind::TryBlock(..)
| ast::ExprKind::Loop(..)
Expand Down
4 changes: 4 additions & 0 deletions tests/target/async_closure.rs
Expand Up @@ -15,4 +15,8 @@ fn main() {
let x = 3;
x
};

let f = |x| async {
println!("hello, world");
};
}

0 comments on commit 731f155

Please sign in to comment.