Skip to content

Commit 31e8632

Browse files
committed
Fix construction of UseGroup containing crate roots
1 parent 037861a commit 31e8632

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/item.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,14 +1411,16 @@ pub(crate) mod parsing {
14111411
&content,
14121412
allow_crate_root_in_path && !this_tree_starts_with_crate_root,
14131413
)? {
1414-
Some(tree) => items.push_value(tree),
1415-
None => has_any_crate_root_in_path = true,
1414+
Some(tree) if !has_any_crate_root_in_path => items.push_value(tree),
1415+
_ => has_any_crate_root_in_path = true,
14161416
}
14171417
if content.is_empty() {
14181418
break;
14191419
}
14201420
let comma: Token![,] = content.parse()?;
1421-
items.push_punct(comma);
1421+
if !has_any_crate_root_in_path {
1422+
items.push_punct(comma);
1423+
}
14221424
}
14231425
if has_any_crate_root_in_path {
14241426
Ok(None)

0 commit comments

Comments
 (0)