-
Notifications
You must be signed in to change notification settings - Fork 972
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-ICEI-changes-semanticsIssue: changes observable semantics of the code (even if code still compiles!)Issue: changes observable semantics of the code (even if code still compiles!)I-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failS-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 issueUO-imports_granularityUnstable option: imports_granularityUnstable option: imports_granularityonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce
Description
#![no_implicit_prelude]
extern crate alloc;
use alloc::boxed;
use alloc::vec;
use alloc::vec::Vec;
fn main() {
let _: Vec<i32> = vec![];
}turns into
#![no_implicit_prelude]
extern crate alloc;
use alloc::{
boxed,
vec::{self, Vec},
};
fn main() {
let _: Vec<i32> = vec![];
}after
$ rustfmt --unstable-features --config imports_granularity=One ./src/main.rsThis is no longer valid rust, as the vec! macro isnt in scope anymore.
tested on latest nightly:
$ rustfmt -V
rustfmt 1.8.0-nightly (d5419f1e97 2025-10-30)
$ rustc -V
rustc 1.93.0-nightly (d5419f1e9 2025-10-30)
DianaNites
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-ICEI-changes-semanticsIssue: changes observable semantics of the code (even if code still compiles!)Issue: changes observable semantics of the code (even if code still compiles!)I-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failS-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 issueUO-imports_granularityUnstable option: imports_granularityUnstable option: imports_granularityonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce