rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.02k stars 888 forks source link

strange behavior for duplicate imports with imports_granularity="Module" #6243

Open xxchan opened 3 months ago

xxchan commented 3 months ago

e.g.,

use risingwave_batch::executor::{BoxedExecutor, JoinType};
use risingwave_batch::executor::{BoxedExecutor, JoinType};

After first fmt

use risingwave_batch::executor::{BoxedExecutor, BoxedExecutor, JoinType, JoinType};

After second fmt

use risingwave_batch::executor::{BoxedExecutor, JoinType, JoinType};

The behavior I want is that it can remove duplicates, like imports_granularity="Crate"

ytmimi commented 3 months ago

Confirming I can reproduce this when building from source using rustfmt 1.7.1-nightly (7cdb426c 2024-07-15). Linking the tracking issue for imports_granularity (https://github.com/rust-lang/rustfmt/issues/4991)