about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortopecongiro <seuchida@gmail.com>2017-05-23 22:12:52 +0900
committertopecongiro <seuchida@gmail.com>2017-05-23 22:12:52 +0900
commitcb4a6a24191f1a5535a6694b2310be5ac9d60bfe (patch)
treee966db2a18f818c17359d8b235b9157c9cf674c6 /src
parenta83d4876e735a795b5f1eaec4687d55c079be6df (diff)
Use correct width when rewriting chain
Diffstat (limited to 'src')
-rw-r--r--src/chains.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/chains.rs b/src/chains.rs
index 92f4aa212a2..7ab81aa7197 100644
--- a/src/chains.rs
+++ b/src/chains.rs
@@ -139,14 +139,8 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
         (shape.block_indent(context.config.tab_spaces()), false)
     };
 
-    let max_width = try_opt!((shape.width + shape.indent.width() + shape.offset)
-                                 .checked_sub(nested_shape.indent.width() +
-                                              nested_shape.offset));
+    let other_child_shape = nested_shape.with_max_width(context.config);
 
-    let other_child_shape = Shape {
-        width: max_width,
-        ..nested_shape
-    };
     let first_child_shape = if extend {
         let overhead = last_line_width(&parent_rewrite);
         let offset = parent_rewrite.lines().rev().next().unwrap().trim().len();