]> git.lizzy.rs Git - rust.git/commitdiff
Put imports list on the next line if it exceeds max width
authorSeiichi Uchida <seiichi.uchida@dena.com>
Thu, 5 Apr 2018 04:24:18 +0000 (13:24 +0900)
committerSeiichi Uchida <seiichi.uchida@dena.com>
Thu, 5 Apr 2018 04:24:18 +0000 (13:24 +0900)
src/imports.rs

index f631f4b9c2667e32df2bd64267502b0374006d11..5b7c16ecc75aa2fdb13432c5f4ffbfec4901426d 100644 (file)
@@ -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{}}}",