- let mut rewrite = expr.rewrite(context, shape);
- rewrite = rewrite.and_then(|rw| {
- if context.config.force_multiline_blocks() && rw.contains('\n') {
- None
- } else {
- Some(rw)
+ fn allow_multi_line(expr: &ast::Expr) -> bool {
+ match expr.node {
+ ast::ExprKind::Match(..)
+ | ast::ExprKind::Block(..)
+ | ast::ExprKind::Catch(..)
+ | ast::ExprKind::Loop(..)
+ | ast::ExprKind::Struct(..) => true,
+
+ ast::ExprKind::AddrOf(_, ref expr)
+ | ast::ExprKind::Box(ref expr)
+ | ast::ExprKind::Try(ref expr)
+ | ast::ExprKind::Unary(_, ref expr)
+ | ast::ExprKind::Cast(ref expr, _) => allow_multi_line(expr),
+
+ _ => false,