Lint on unused `version` field with git/path dependencies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
What it does
Users may add the version field, thinking its relevant for git/path dependencies when it is instead adding a fallback registry source when published. While we can't tell if the user intended it when publish = true, we can when publish = false. Granted, publish = false being the default (#6153) would make this more likely to be beneficial
Inspired by #16161
Advantage
- Help users better understand what the
versionfield does
Drawbacks
- Not enough people benefit because
publish = true(intentional publish) - Not enough people benefit because of the
publish = truedefault (not published but haven't told cargo)
Example
[package]
name = "foo"
publish = false
[dependencies]
serde = { git = "https://github.com/serde-rs/serde.git", version = "1" }
Could be written as:
[package]
name = "foo"
publish = false
[dependencies]
serde = { git = "https://github.com/serde-rs/serde.git" }
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 tracing Cargo's package manifest validation and dependency handling for the version field, especially when publish = false and a dependency uses git or path. Define the lint behavior from the examples: warn about the unused field in that case, while preserving valid use cases when publishing is intended.
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
- 35/100