Use correct heuristic for match block flattening

This commit is contained in:
Ivan Molodetskikh 2018-09-11 08:41:16 +03:00
parent f116baeed7
commit 838df8dfb6
No known key found for this signature in database
GPG key ID: 02CE38DA47E9D691
4 changed files with 22 additions and 20 deletions

View file

@ -179,11 +179,13 @@ pub fn format_expr(
Some(format!("break{}", id_str))
}
}
ast::ExprKind::Yield(ref opt_expr) => if let Some(ref expr) = *opt_expr {
rewrite_unary_prefix(context, "yield ", &**expr, shape)
} else {
Some("yield".to_string())
},
ast::ExprKind::Yield(ref opt_expr) => {
if let Some(ref expr) = *opt_expr {
rewrite_unary_prefix(context, "yield ", &**expr, shape)
} else {
Some("yield".to_string())
}
}
ast::ExprKind::Closure(capture, asyncness, movability, ref fn_decl, ref body, _) => {
closures::rewrite_closure(
capture, asyncness, movability, fn_decl, body, expr.span, context, shape,