Skip to content

removing unused imports generates invalid use module_name::self #17139

Closed
@harrysarson

Description

@harrysarson

rust-analyzer version: rust-analyzer version: 0.3.1932-standalone (47a901b 2024-04-21)

rustc version: rustc 1.79.0-nightly (ef8b9dcf2 2024-04-24)

editor or extension: VScode v0.3.1932

code snippet to reproduce:

mod inner {
    pub struct X();
    pub struct Y();
}

mod z {
    use super::inner::{self, X}$0;

    fn f() {
        let y = inner::Y();
    }
}

becomes

mod inner {
    pub struct X();
    pub struct Y();
}

mod z {
    use super::inner:self;

    fn f() {
        let y = inner::Y();
    }
}

which is invalid. It should be use super::inner instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions