-
Notifications
You must be signed in to change notification settings - Fork 1k
inconsistent imports sorting when merging imports #6830
Copy link
Copy link
Open
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEF-impacts-stable-default-formatExpected formatting impact: affects stable default format configuration (caution)Expected formatting impact: affects stable default format configuration (caution)F-impacts-stable-formatted-codeExpected formatting impact: affects stable formatted code (caution)Expected formatting impact: affects stable formatted code (caution)F-impacts-stable-optionsExpected formatting impact: impacts stable options (caution)Expected formatting impact: impacts stable options (caution)I-unexpected-motionIssue: unexpected motion of code or commentsIssue: unexpected motion of code or commentsS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issueSO-reorder_importsStable option: reorder_importsStable option: reorder_imports
Metadata
Metadata
Assignees
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEF-impacts-stable-default-formatExpected formatting impact: affects stable default format configuration (caution)Expected formatting impact: affects stable default format configuration (caution)F-impacts-stable-formatted-codeExpected formatting impact: affects stable formatted code (caution)Expected formatting impact: affects stable formatted code (caution)F-impacts-stable-optionsExpected formatting impact: impacts stable options (caution)Expected formatting impact: impacts stable options (caution)I-unexpected-motionIssue: unexpected motion of code or commentsIssue: unexpected motion of code or commentsS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issueSO-reorder_importsStable option: reorder_importsStable option: reorder_imports
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
I had this code:
Then I merged the imports on the first two lines into this:
rustfmt then swapped the lines:
Expected behavior
I expected to see this happen: imports of items from
superstay at the topActual behavior
Instead, this happened: imports from
super::moduleget sorted above items fromsuperConfiguration
rustfmtcli options used (if applicable):rustfmtconfiguration file (e.g.rustfmt.toml, if applicable): n/aReproduction Steps
See summary
Meta
rustfmt --version:It can be more cleary seen with this code:
The merged imports are put below
use super::module ..., normal imports likeuse super::CONSTANThere is correctly put at the top.