From 04227a7d300817402b08ad4681054c3a122bf200 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Fri, 6 Apr 2018 10:31:57 +0900 Subject: [PATCH] Fix up merge mess --- src/imports.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/imports.rs b/src/imports.rs index 9bd1ccb86c2..b9625a66e1e 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -460,7 +460,7 @@ fn rewrite_nested_use_tree( list_item.item = use_tree.rewrite(context, nested_shape); list_items.push(list_item); } - let tactic = if use_tree_list.iter().any(|use_segment| { + let (tactic, remaining_width) = if use_tree_list.iter().any(|use_segment| { use_segment .path .last() @@ -469,14 +469,16 @@ fn rewrite_nested_use_tree( _ => false, }) }) { - DefinitiveListTactic::Vertical + (DefinitiveListTactic::Vertical, 0) } else { - definitive_tactic( + let remaining_width = shape.width.checked_sub(2).unwrap_or(0); + let tactic = definitive_tactic( &list_items, context.config.imports_layout(), Separator::Comma, - shape.width.checked_sub(2).unwrap_or(0), - ) + remaining_width, + ); + (tactic, remaining_width) }; let ends_with_newline = context.config.imports_indent() == IndentStyle::Block && tactic != DefinitiveListTactic::Horizontal;