File tree Expand file tree Collapse file tree 3 files changed +205
-2
lines changed Expand file tree Collapse file tree 3 files changed +205
-2
lines changed Original file line number Diff line number Diff line change @@ -589,7 +589,7 @@ impl UseTree {
589589
590590 // Normalise foo::{bar} -> foo::bar
591591 if let UseSegmentKind :: List ( ref list) = last. kind {
592- if list. len ( ) == 1 && list[ 0 ] . to_string ( ) != "self" {
592+ if list. len ( ) == 1 && list[ 0 ] . to_string ( ) != "self" && !list [ 0 ] . has_comment ( ) {
593593 normalize_sole_list = true ;
594594 }
595595 }
@@ -1032,7 +1032,9 @@ fn rewrite_nested_use_tree(
10321032
10331033 let list_str = write_list ( & list_items, & fmt) ?;
10341034
1035- let result = if ( list_str. contains ( '\n' ) || list_str. len ( ) > remaining_width)
1035+ let result = if ( list_str. contains ( '\n' )
1036+ || list_str. len ( ) > remaining_width
1037+ || tactic == DefinitiveListTactic :: Vertical )
10361038 && context. config . imports_indent ( ) == IndentStyle :: Block
10371039 {
10381040 format ! (
Original file line number Diff line number Diff line change 1+ use std:: {
2+ fs,
3+ // (temporarily commented, we'll need this again in a second) io,
4+ } ;
5+
6+ use foo:: {
7+ self // this is important
8+ } ;
9+
10+ use foo :: bar
11+ ;
12+
13+ use foo:: { bar} ;
14+
15+ use foo:: {
16+ bar
17+ // abc
18+ } ;
19+
20+ use foo:: {
21+ bar,
22+ // abc
23+ } ;
24+
25+ use foo:: {
26+ // 345
27+ bar
28+ } ;
29+
30+ use foo:: {
31+ self
32+ // abc
33+ } ;
34+
35+ use foo:: {
36+ self ,
37+ // abc
38+ } ;
39+
40+ use foo:: {
41+ // 345
42+ self
43+ } ;
44+
45+ use foo:: {
46+ self // a
47+ ,
48+ } ;
49+
50+ use foo:: { self /* a */ } ;
51+
52+ use foo:: { self /* a */ , } ;
53+
54+ use foo:: {
55+ // abc
56+ abc:: {
57+ xyz
58+ // 123
59+ }
60+ } ;
61+
62+ use foo:: {
63+ // abc
64+ bar,
65+ abc
66+ } ;
67+
68+ use foo:: {
69+ bar,
70+ // abc
71+ abc
72+ } ;
73+
74+ use foo:: {
75+ bar,
76+ abc
77+ // abc
78+ } ;
79+
80+ use foo:: {
81+ bar,
82+ abc,
83+ // abc
84+ } ;
85+
86+ use foo:: {
87+ self ,
88+ // abc
89+ abc:: {
90+ xyz
91+ // 123
92+ }
93+ } ;
94+
95+ use foo:: {
96+ self ,
97+ // abc
98+ abc:: {
99+ // 123
100+ xyz
101+ }
102+ } ;
103+
104+ use path:: { self /*comment*/ , } ;
Original file line number Diff line number Diff line change 1+ use std:: {
2+ fs,
3+ // (temporarily commented, we'll need this again in a second) io,
4+ } ;
5+
6+ use foo:: {
7+ self , // this is important
8+ } ;
9+
10+ use foo:: bar;
11+
12+ use foo:: bar;
13+
14+ use foo:: {
15+ bar, // abc
16+ } ;
17+
18+ use foo:: {
19+ bar,
20+ // abc
21+ } ;
22+
23+ use foo:: {
24+ // 345
25+ bar,
26+ } ;
27+
28+ use foo:: {
29+ self , // abc
30+ } ;
31+
32+ use foo:: {
33+ self ,
34+ // abc
35+ } ;
36+
37+ use foo:: {
38+ // 345
39+ self ,
40+ } ;
41+
42+ use foo:: {
43+ self , // a
44+ } ;
45+
46+ use foo:: { self /* a */ } ;
47+
48+ use foo:: { self /* a */ } ;
49+
50+ use foo:: {
51+ // abc
52+ abc:: {
53+ xyz, // 123
54+ } ,
55+ } ;
56+
57+ use foo:: {
58+ abc,
59+ // abc
60+ bar,
61+ } ;
62+
63+ use foo:: {
64+ // abc
65+ abc,
66+ bar,
67+ } ;
68+
69+ use foo:: {
70+ abc, // abc
71+ bar,
72+ } ;
73+
74+ use foo:: {
75+ abc,
76+ // abc
77+ bar,
78+ } ;
79+
80+ use foo:: {
81+ self ,
82+ // abc
83+ abc:: {
84+ xyz, // 123
85+ } ,
86+ } ;
87+
88+ use foo:: {
89+ self ,
90+ // abc
91+ abc:: {
92+ // 123
93+ xyz,
94+ } ,
95+ } ;
96+
97+ use path:: { self /*comment*/ } ;
You can’t perform that action at this time.
0 commit comments