Skip to content

Commit b636723

Browse files
rsammelsonytmimi
authored andcommitted
Improve tests for rust-lang#5852
1 parent c7c57f8 commit b636723

14 files changed

+874
-0
lines changed

tests/source/issue-3984.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use a::{item /* comment */};
2+
use b::{
3+
a,
4+
// comment
5+
item,
6+
};
7+
use c::item /* comment */;
8+
use d::item; // really long comment (with `use` exactly 100 characters) ____________________________
9+
10+
use std::e::{/* it's a comment! */ bar /* and another */};
11+
use std::f::{/* it's a comment! */ bar};
12+
use std::g::{bar /* and another */};
File renamed without changes.

tests/source/issue-5852/horizontal.rs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// rustfmt-imports_layout: Horizontal
2+
3+
use std::{
4+
fs,
5+
// (temporarily commented, we'll need this again in a second) io,
6+
};
7+
8+
use foo::{
9+
self // this is important
10+
};
11+
12+
use foo :: bar
13+
;
14+
15+
use foo::{bar};
16+
17+
use foo::{
18+
bar
19+
// abc
20+
};
21+
22+
use foo::{
23+
bar,
24+
// abc
25+
};
26+
27+
use foo::{
28+
// 345
29+
bar
30+
};
31+
32+
use foo::{
33+
self
34+
// abc
35+
};
36+
37+
use foo::{
38+
self,
39+
// abc
40+
};
41+
42+
use foo::{
43+
// 345
44+
self
45+
};
46+
47+
use foo::{
48+
self // a
49+
,
50+
};
51+
52+
use foo::{ self /* a */ };
53+
54+
use foo::{ self /* a */, };
55+
56+
use foo::{
57+
// abc
58+
abc::{
59+
xyz
60+
// 123
61+
}
62+
};
63+
64+
use foo::{
65+
// abc
66+
bar,
67+
abc
68+
};
69+
70+
use foo::{
71+
bar,
72+
// abc
73+
abc
74+
};
75+
76+
use foo::{
77+
bar,
78+
abc
79+
// abc
80+
};
81+
82+
use foo::{
83+
bar,
84+
abc,
85+
// abc
86+
};
87+
88+
use foo::{
89+
self,
90+
// abc
91+
abc::{
92+
xyz
93+
// 123
94+
}
95+
};
96+
97+
use foo::{
98+
self,
99+
// abc
100+
abc::{
101+
// 123
102+
xyz
103+
}
104+
};
105+
106+
use path::{self /*comment*/,};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// rustfmt-imports_layout: HorizontalVertical
2+
3+
use std::{
4+
fs,
5+
// (temporarily commented, we'll need this again in a second) io,
6+
};
7+
8+
use foo::{
9+
self // this is important
10+
};
11+
12+
use foo :: bar
13+
;
14+
15+
use foo::{bar};
16+
17+
use foo::{
18+
bar
19+
// abc
20+
};
21+
22+
use foo::{
23+
bar,
24+
// abc
25+
};
26+
27+
use foo::{
28+
// 345
29+
bar
30+
};
31+
32+
use foo::{
33+
self
34+
// abc
35+
};
36+
37+
use foo::{
38+
self,
39+
// abc
40+
};
41+
42+
use foo::{
43+
// 345
44+
self
45+
};
46+
47+
use foo::{
48+
self // a
49+
,
50+
};
51+
52+
use foo::{ self /* a */ };
53+
54+
use foo::{ self /* a */, };
55+
56+
use foo::{
57+
// abc
58+
abc::{
59+
xyz
60+
// 123
61+
}
62+
};
63+
64+
use foo::{
65+
// abc
66+
bar,
67+
abc
68+
};
69+
70+
use foo::{
71+
bar,
72+
// abc
73+
abc
74+
};
75+
76+
use foo::{
77+
bar,
78+
abc
79+
// abc
80+
};
81+
82+
use foo::{
83+
bar,
84+
abc,
85+
// abc
86+
};
87+
88+
use foo::{
89+
self,
90+
// abc
91+
abc::{
92+
xyz
93+
// 123
94+
}
95+
};
96+
97+
use foo::{
98+
self,
99+
// abc
100+
abc::{
101+
// 123
102+
xyz
103+
}
104+
};
105+
106+
use path::{self /*comment*/,};
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
};

tests/source/issue-5852/split.rs

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// rustfmt-imports_granularity: Item
2+
3+
use std::{
4+
fs,
5+
// (temporarily commented, we'll need this again in a second) io,
6+
};
7+
8+
use foo::{
9+
self // this is important
10+
};
11+
12+
use foo :: bar
13+
;
14+
15+
use foo::{bar};
16+
17+
use foo::{
18+
bar
19+
// abc
20+
};
21+
22+
use foo::{
23+
bar,
24+
// abc
25+
};
26+
27+
use foo::{
28+
// 345
29+
bar
30+
};
31+
32+
use foo::{
33+
self
34+
// abc
35+
};
36+
37+
use foo::{
38+
self,
39+
// abc
40+
};
41+
42+
use foo::{
43+
// 345
44+
self
45+
};
46+
47+
use foo::{
48+
self // a
49+
,
50+
};
51+
52+
use foo::{ self /* a */ };
53+
54+
use foo::{ self /* a */, };
55+
56+
use foo::{
57+
// abc
58+
abc::{
59+
xyz
60+
// 123
61+
}
62+
};
63+
64+
use foo::{
65+
bar,
66+
abc
67+
};
68+
69+
use foo::{
70+
// abc
71+
bar,
72+
abc
73+
};
74+
75+
use foo::{
76+
bar,
77+
// abc
78+
abc
79+
};
80+
81+
use foo::{
82+
bar,
83+
abc
84+
// abc
85+
};
86+
87+
use foo::{
88+
bar,
89+
abc,
90+
// abc
91+
};
92+
93+
use foo::{
94+
self,
95+
// abc
96+
abc::{
97+
xyz
98+
// 123
99+
}
100+
};
101+
102+
use foo::{
103+
self,
104+
// abc
105+
abc::{
106+
// 123
107+
xyz
108+
}
109+
};
110+
111+
use path::{self /*comment*/,};

0 commit comments

Comments
 (0)