-
Notifications
You must be signed in to change notification settings - Fork 997
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
Description
Summary
I had this code:
use super::Enum;
use super::Struct;
use super::module::Trait;Then I merged the imports on the first two lines into this:
use super::{Enum, Struct};
use super::module::Trait;rustfmt then swapped the lines:
use super::module::Trait;
use super::{Enum, Struct};Expected behavior
I expected to see this happen: imports of items from super stay at the top
Actual behavior
Instead, this happened: imports from super::module get sorted above items from super
Configuration
rustfmt cli options used (if applicable):
$ rustfmt main.rs --edition 2024rustfmt configuration file (e.g. rustfmt.toml, if applicable): n/a
Reproduction Steps
See summary
Meta
rustfmt --version:
rustfmt 1.8.0-stable (4a4ef493e3 2026-03-02)
It can be more cleary seen with this code:
use super::CONSTANT;
use super::module::Trait;
use super::{Enum, Struct};The merged imports are put below use super::module ..., normal imports like use super::CONSTANT here is correctly put at the top.
Reactions are currently unavailable
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.