rust-lang / rust-lang/rust-clippy
[feat] report unused feature
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
When dev, may enable some features.
// lib.rs
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
// hello.rs
code
code using generic_const_exprs
code
Then later, the related code using feature are removed.
// hello.rs
code
code
But maybe forget to remove these header.
// lib.rs
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
Advantage
-
clean
lib.rs -
per delete line, per SLOW build
Drawbacks
There seems many features, not sure if clippy can get info from rustc about unused feature.
Example
For scenario, related code are remove.
// hello.rs
code
code
Rerport all unused #![feature(XXX)]
// lib.rs
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
And maybe also report not need to enable features, feature need to enable before prev rust version but no need within new rust.
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 examples in lib.rs and hello.rs, then investigate whether rustc exposes enough information for Clippy to identify unused or no-longer-needed #![feature(...)] declarations. Done would be a defined, supportable report for the requested unused-feature scenario, with its scope and limitations documented.
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
- Needs clarification
- Newbie friendliness
- 25/100