Merge pull request #3462 from stjepang/fix-async-formatting

Fix formatting of async blocks
This commit is contained in:
Seiichi Uchida 2019-03-21 15:37:25 +09:00 committed by GitHub
commit 0732cd69b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(())
});
}