Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Starwort opened this issue Aug 30, 2023 · 1 comment · Fixed by #11979
Closed
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-pedantic Lint: Belongs in the pedantic lint group

Comments

@Starwort
Copy link

Starwort commented Aug 30, 2023

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

@rustbot rustbot added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-pedantic Lint: Belongs in the pedantic lint group labels Aug 30, 2023
@J-ZhengLi
Copy link
Member

@rustbot claim

bors added a commit that referenced this issue Jan 31, 2024
add configuration for [`wildcard_imports`] to ignore certain imports

fixes: #11428

changelog: add configuration `ignored-wildcard-imports` for lint [`wildcard_imports`]
@bors bors closed this as completed in c82162e Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-pedantic Lint: Belongs in the pedantic lint group
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants