Skip to content

Suggest use self::Thing::OtherThing when using use Thing::OtherThing #34191

Closed
@jonas-schievink

Description

@jonas-schievink

This frequently happens for code like this:

mod m {
    enum MyEnum {
        MyVariant
    }

    // Import all variants:
    use MyEnum::*;
}

fn main() {}

Since this will compile when putting ms contents into the main module, this can be quite confusing (for example when refactoring some code into it's own module).

Currently, this yields error: unresolved import MyEnum::*. Maybe a missing extern crate MyEnum?. When this case is detected, the Maybe a missing extern crate MyEnum? probably shouldn't be printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions