From 1fa06ecf1ef7684b4ed3674028aa304e62ddfd90 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 20 Mar 2019 18:18:02 +0100 Subject: [PATCH] Fix formatting of async blocks --- src/expr.rs | 2 +- tests/source/async_block.rs | 16 ++++++++++++++++ tests/target/async_block.rs | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/expr.rs b/src/expr.rs index 068b8f7fed6bc..90cbba334f1a8 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1357,7 +1357,7 @@ pub fn can_be_overflowed_expr( } // Handle always block-like expressions - ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => true, + ast::ExprKind::Async(..) | ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => true, // Handle `[]` and `{}`-like expressions ast::ExprKind::Array(..) | ast::ExprKind::Struct(..) => { diff --git a/tests/source/async_block.rs b/tests/source/async_block.rs index a7018316812d9..3de51a084d260 100644 --- a/tests/source/async_block.rs +++ b/tests/source/async_block.rs @@ -16,4 +16,20 @@ fn baz() { let y = async { Ok(()) }; // comment + + spawn( + a, + async move { + action(); + Ok(()) + }, + ); + + spawn( + a, + async move || { + action(); + Ok(()) + }, + ); } diff --git a/tests/target/async_block.rs b/tests/target/async_block.rs index 5c1649373adef..258dd937a6f56 100644 --- a/tests/target/async_block.rs +++ b/tests/target/async_block.rs @@ -12,4 +12,14 @@ fn baz() { }; let y = async { Ok(()) }; // comment + + spawn(a, async move { + action(); + Ok(()) + }); + + spawn(a, async move || { + action(); + Ok(()) + }); }