cargo-toml-format icon indicating copy to clipboard operation
cargo-toml-format copied to clipboard

Feature idea: lint workspace dependencies

Open yaymukund opened this issue 1 year ago • 1 comments

Hi Timon, big fan of your crates, had this idea:

  1. In cargo_fmt_manifest.toml:

    workspace-only-dependencies = [
        "clap",
        "crossterm",
        "tokio",
    ]
    
  2. This should now be an error:

    [dependencies]
    clap = "4.1"
    

    e.g.:

    Error: clap is defined at the workspace level, yet its version is specified as "4.1". Please specify it as clap = { workspace = true }. See:

    https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table

    Hmm, the error message should probably also mention the workspace-only-dependencies array.

What do you think?

yaymukund avatar Mar 04 '23 16:03 yaymukund