-
Notifications
You must be signed in to change notification settings - Fork 963
Description
This is similar to #3720, but for group_imports settings such as StdExternalCrate. rust-lang/rust#126776 shows the consequences of that: it is now impossible to have a "chunk" of use statements that have a comment above them. rustfmt will happily reorder them and keep the comment attached to the immediate use item after it, therefore fundamentally changing its meaning. That's extremely frustrating -- having the tool make it essentially impossible to have comments that clarify the intent of my code.
In situations like this:
use a;
use b;
use c;
// comment
use d;
use e;rustfmt should view the comment as "breaking apart" the use block into multiple blocks, similar to what it does if there was something else, like a mod, in place of the comment. group_imports should then be applied to both groups separately. That would avoid such semantics-altering reformatting.