Skip to content

Consider splitting unused_import's glob re-export visibility warning into its own lint #123210

Open
@arifd

Description

@arifd

Code

mod foo {
    pub use bar::*;
    mod bar {
        pub(crate) fn baz() {}
    }
}

fn main() {
    foo::baz();
}

Current output

warning: glob import doesn't reexport anything because no candidate is public enough
 --> src/main.rs:2:13
  |
2 |     pub use bar::*;
  |             ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Desired output

No response

Rationale and extra context

An unused import lint feels wrong to be because i am using baz.

Other cases

No response

Rust Version

rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: aarch64-apple-darwin
release: 1.75.0
LLVM version: 17.0.6

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.L-unused_importsLint: unused_importsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions