Fix formatting of async blocks

This commit is contained in:
Stjepan Glavina 2019-03-20 18:18:02 +01:00
parent 393d7217ae
commit 1fa06ecf1e
3 changed files with 27 additions and 1 deletions

View File

@ -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(..) => {

View File

@ -16,4 +16,20 @@ fn baz() {
let y = async {
Ok(())
}; // comment
spawn(
a,
async move {
action();
Ok(())
},
);
spawn(
a,
async move || {
action();
Ok(())
},
);
}

View File

@ -12,4 +12,14 @@ fn baz() {
};
let y = async { Ok(()) }; // comment
spawn(a, async move {
action();
Ok(())
});
spawn(a, async move || {
action();
Ok(())
});
}