Merge pull request #3044 from orium/fix-too-many-modsep
Fix bug in import where two consecutive module separators were possible.
This commit is contained in:
commit
ff4fe5db13
@ -324,11 +324,15 @@ impl UseTree {
|
||||
&& a.prefix.to_string().len() > 2
|
||||
&& a.prefix.to_string().starts_with("::");
|
||||
|
||||
let mut modsep = leading_modsep;
|
||||
|
||||
for p in &a.prefix.segments {
|
||||
if let Some(use_segment) = UseSegment::from_path_segment(context, p, leading_modsep) {
|
||||
if let Some(use_segment) = UseSegment::from_path_segment(context, p, modsep) {
|
||||
result.path.push(use_segment);
|
||||
modsep = false;
|
||||
}
|
||||
}
|
||||
|
||||
match a.kind {
|
||||
UseTreeKind::Glob => {
|
||||
result.path.push(UseSegment::Glob);
|
||||
|
5
tests/target/issue-3043.rs
Normal file
5
tests/target/issue-3043.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// rustfmt-edition: 2018
|
||||
|
||||
use ::std::vec::Vec;
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user