From 038436919d762bf6fbdd87ce4e824f8c8c0c8822 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Tue, 28 Mar 2017 10:50:58 +1300 Subject: [PATCH] Put the second element of a chain on its own line when block formatting. --- src/chains.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chains.rs b/src/chains.rs index 4eda33d9647..70e6d951c2d 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -113,7 +113,8 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - } else { chain_indent(context, shape.add_offset(parent_rewrite.len())) }; - (nested_shape, true) + (nested_shape, context.config.chain_indent == IndentStyle::Visual || + parent_rewrite.len() <= context.config.tab_spaces) } else if is_block_expr(&parent, &parent_rewrite) { // The parent is a block, so align the rest of the chain with the closing // brace.