Skip to content

Deduplication doesn't occur with `imports_granularity = "Item" #4725

Closed
@djmarcin

Description

@djmarcin

Describe the bug

Duplicate imports are not removed with imports_granularity = "Item" turned on.

To Reproduce

test.rs

use std::env;
use std::env;

fn main() {
  println!("{:?}", env::var("TEST"));
}

.rustfmt.toml

unstable_features = true
edition = "2018"
imports_granularity = "Item"

Run rustfmt test.rs

Expected behavior

Duplicate use std::env; should be removed. It is not.

Meta

  • rustfmt version: rustfmt 1.4.36-nightly (7de6968 2021-02-07)
  • From where did you install rustfmt?: asdf install with .tool-versions rust nightly-2021-02-17
  • How do you run rustfmt: rustfmt, in VSCode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions