rust-lang / rust-lang/rust-clippy
Check usages of empty features
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
Check for all "empty" features in Cargo.toml (a_feature = []), with no optional dependency name collisions, and try to find if any config attribute in the file has that feature, if it doesn't, raise.
Lint Name
unused_crate_feature
Category
pedantic
Advantage
- Allow libraries to clean up unused features, which could then signal downstream that something has changed.
- Cleaner code and crates, with less "cruft"
Drawbacks
Possible false-positives if cargo were to infer more from features in the future (other than optional dependencies and the likes)
Example
[features]
a_thing = []
This feature is nowhere to be found in any source code, so this raises the warning.
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
Start with the [features] section in Cargo.toml and the source code that handles crate features and config attributes. Check how optional dependency name collisions and feature references are represented before defining the lint. Done means unused_crate_feature reports empty features with no optional dependency collision when no source configuration attribute uses them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100