Skip to content

Lint on unused version field with git/path dependencies #16166

@epage

Description

@epage

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 version field does

Drawbacks

  • Not enough people benefit because publish = true (intentional publish)
  • Not enough people benefit because of the publish = true default (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" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-lintArea: new lintS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions