Skip to content

Commit 636de83

Browse files
committed
Put imports list on the next line if it exceeds max width
1 parent 8f615af commit 636de83

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/imports.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ fn rewrite_nested_use_tree(
366366
};
367367
let list_str = write_list(&items[first_index..], &fmt)?;
368368

369-
let result = if list_str.contains('\n') && context.config.imports_indent() == IndentStyle::Block
369+
let result = if (list_str.contains('\n') || list_str.len() > remaining_width)
370+
&& context.config.imports_indent() == IndentStyle::Block
370371
{
371372
format!(
372373
"{}{{\n{}{}\n{}}}",

0 commit comments

Comments
 (0)