Skip to content

Auto-import of an item that's already conditionally-imported creates a duplicate import #18509

@svix-jplatte

Description

@svix-jplatte
  • given an input like
    #[cfg(feature = "foo")]
    use std::collections::HashMap;
    
    fn bar() -> HashMap {
        todo!()
    }
  • with foo being an inactive feature cfg in the current RA session
  • when using the import assist on HashMap
  • a second use std::collections::HashMap; is generated
  • which will result in a duplicate import error when the code is compiled with --feature foo

rust-analyzer version: 0.4.2183-standalone
rustc version: 1.84.0-nightly (b8c8287 2024-11-03)
editor or extension: VSCode w/ RA v0.4.2183 (pre-release)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsA-nameresname, path and module resolutionC-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions