Skip to content

Commit ee08c47

Browse files
committed
fix merge_mix
1 parent 36c49d7 commit ee08c47

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

src/imports.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,13 @@ fn rewrite_nested_use_tree(
694694
})
695695
});
696696
let (tactic, remaining_width) = if has_nested_list {
697-
(DefinitiveListTactic::Vertical, 0)
697+
let tactic = definitive_tactic(
698+
&list_items,
699+
context.config.imports_layout(),
700+
Separator::Comma,
701+
0,
702+
);
703+
(tactic, 0)
698704
} else {
699705
let remaining_width = shape.width.checked_sub(2).unwrap_or(0);
700706
let tactic = definitive_tactic(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-imports_indent: Block
2+
// rustfmt-merge_imports: true
3+
// rustfmt-imports_layout: Mixed
4+
5+
use std::{fmt, io, str};
6+
use std::str::FromStr;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// rustfmt-imports_indent: Block
2+
// rustfmt-merge_imports: true
3+
// rustfmt-imports_layout: Mixed
4+
5+
use std::{
6+
fmt, io, str::{self, FromStr},
7+
};

tests/target/imports.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,20 @@ use self::unix::{};
8080

8181
// nested imports
8282
use foo::{
83-
a,
84-
b,
83+
a, b,
8584
bar::{
86-
baz,
87-
foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz},
88-
qux,
89-
xxxxxxxxxxx,
90-
yyyyyyyyyyyyy,
91-
zzzzzzzzzzzzzzzz,
85+
baz, foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz}, qux, xxxxxxxxxxx,
86+
yyyyyyyyyyyyy, zzzzzzzzzzzzzzzz,
9287
},
93-
boo,
94-
c,
88+
boo, c,
9589
};
9690

9791
use fooo::{
9892
baar::foobar::{
9993
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
10094
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
10195
},
102-
bar,
103-
bar::*,
104-
x,
105-
y,
106-
z,
96+
bar, bar::*, x, y, z,
10797
};
10898

10999
// nested imports with a single sub-tree.

0 commit comments

Comments
 (0)