rust-lang / rust-lang/rust-clippy
Deny imports from (configurable) modules
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
If you have two modules containing equally or almost equally named types, you sometimes want to make sure that you never import any of these types, but always specify them by their path.
To ensure that, this lint denies importing from configured modules, and suggests to import the module instead.
Advantage
No more ambiguity when having multiple types named equally that you might mix up accidentially.
Drawbacks
No response
Example
use crate::foo::Something;
// lots of code
fn process_bar_something(smth: Something) {
// ... Use the Something which I would expect to be crate::bar::Something
}
Could be written as:
use crate::bar;
fn process_bar_something(smth: bar::Something) {
// ... Use the Something which I would expect to be crate::bar::Something
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files, tests, or entry points are named in the issue. Start by locating existing Clippy lints for imports and configurable settings, then define the affected module patterns and suggestion behavior; done means configured imports are denied and importing the module is suggested, with coverage for the example cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100