From 636de8313d27d459b36a208326f9907b41da1c16 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Thu, 5 Apr 2018 13:24:18 +0900 Subject: [PATCH] Put imports list on the next line if it exceeds max width --- src/imports.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/imports.rs b/src/imports.rs index f631f4b9c26..5b7c16ecc75 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -366,7 +366,8 @@ fn rewrite_nested_use_tree( }; let list_str = write_list(&items[first_index..], &fmt)?; - let result = if list_str.contains('\n') && context.config.imports_indent() == IndentStyle::Block + let result = if (list_str.contains('\n') || list_str.len() > remaining_width) + && context.config.imports_indent() == IndentStyle::Block { format!( "{}{{\n{}{}\n{}}}", -- 2.44.0