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
3 changed files with 27 additions and 1 deletions
+1 -1
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(..) => {
+16
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(())
},
);
}
+10
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(())
});
}