Skip to content

two runs required on imports with leading ::  #3943

Open
@calebcartwright

Description

@calebcartwright

Formatting can take two runs when imports are using absolute paths and include leading :: (when using the 2018 edition config option)

Original source:

use ::foo;
use ::foo::{Bar};
use ::foo::{Bar, Baz};
use ::{Foo};
use ::{Bar, Baz};

1st formatting result:

use ::foo;
use ::foo::Bar;
use ::foo::{Bar, Baz};
use ::Foo;
use ::{Bar, Baz};

And then second formatting run to get the final result:

use ::Foo;
use ::foo;
use ::foo::Bar;
use ::foo::{Bar, Baz};
use ::{Bar, Baz};

Seems to be related to the first run reducing ::{Foo} to ::Foo but without fully sorting/reordering the set of imports, and then the second run sorting them to finish formatting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-imports`use` syntaxbugPanic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions