This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,10 @@ impl UseTree {
338
338
339
339
match a. kind {
340
340
UseTreeKind :: Glob => {
341
+ // in case of a global path and the glob starts at the root, e.g., "::*"
342
+ if a. prefix . segments . len ( ) == 1 && leading_modsep {
343
+ result. path . push ( UseSegment :: Ident ( "" . to_owned ( ) , None ) ) ;
344
+ }
341
345
result. path . push ( UseSegment :: Glob ) ;
342
346
}
343
347
UseTreeKind :: Nested ( ref list) => {
@@ -356,6 +360,11 @@ impl UseTree {
356
360
false ,
357
361
)
358
362
. collect ( ) ;
363
+ // in case of a global path and the nested list starts at the root,
364
+ // e.g., "::{foo, bar}"
365
+ if a. prefix . segments . len ( ) == 1 && leading_modsep {
366
+ result. path . push ( UseSegment :: Ident ( "" . to_owned ( ) , None ) ) ;
367
+ }
359
368
result. path . push ( UseSegment :: List (
360
369
list. iter ( )
361
370
. zip ( items. into_iter ( ) )
Original file line number Diff line number Diff line change
1
+ // rustfmt-edition: 2018
2
+
3
+ use :: ignore;
4
+ use :: ignore:: some:: more;
5
+ use :: { foo, bar} ;
6
+ use :: * ;
7
+ use :: baz:: { foo, bar} ;
8
+
9
+ fn main ( ) {
10
+ println ! ( "Hello, world!" ) ;
11
+ }
Original file line number Diff line number Diff line change
1
+ // rustfmt-edition: 2018
2
+
3
+ use :: baz:: { bar, foo} ;
4
+ use :: ignore;
5
+ use :: ignore:: some:: more;
6
+ use :: * ;
7
+ use :: { bar, foo} ;
8
+
9
+ fn main ( ) {
10
+ println ! ( "Hello, world!" ) ;
11
+ }
You can’t perform that action at this time.
0 commit comments