Skip to content

[Feature request][wildcard_imports] Configuration option for ignored wildcard imports #11428

Closed
@Starwort

Description

@Starwort

Description

According to the lints page, clippy::wildcard_imports already has exceptions for the following cases:

Wildcard imports are allowed from modules that their name contains prelude. Many crates (including the standard library) provide modules named “prelude” specifically designed for wildcard import.

use super::* is allowed in test modules. This is defined as any module with “test” in the name.

These exceptions can be disabled using the warn-on-all-wildcard-imports configuration flag.

For some other libraries (notably Diesel), other categories of wildcard imports may be desirable to reduce code mess - in the case of Diesel, that's anything ending with dsl::*

It would be nice to be able to configure the set of allowed wildcard imports, rather than simply enabling or disabling the prelude and test exceptions

Version

rustc 1.74.0-nightly (8550f15e1 2023-08-27)
binary: rustc
commit-hash: 8550f15e148407159af401e02b1d9259762b3496
commit-date: 2023-08-27
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Additional Labels

@rustbot label +C-enhancement +L-pedantic

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-pedanticLint: Belongs in the pedantic lint group

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions