cargo (publish) should complain about unused source files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Originally proposed in https://github.com/rust-lang/rust/issues/28711, attempted as a clippy lint in https://github.com/Manishearth/rust-clippy/pull/544. The clippy lint is not really feasible, since it requires knowledge about all other files in the project (main.rs and lib.rs don't know about each other, since they are of different rustc invocations).
Cargo could invoke rustc with --emit dep-info and compile a list of all files mentioned in the resulting .d file. Then, once all required files are collected, it could check that list against the .rs files in the src (and test?) folders and notify the user of any extra files that aren't used in any compilation.
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 by examining Cargo's publish flow and how rustc dependency information is produced for main.rs and lib.rs. Compare the files listed in the resulting .d files with Rust files in the src and test folders. Done means cargo publish identifies unused source files and notifies the user without relying on a Clippy lint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100