I have a workspace package ("virtual manifest" organization) containing two library crates.
$ find . -name lib.rs -o -name Cargo.toml
./Cargo.toml
./my_project/Cargo.toml
./my_project/src/lib.rs
./test_support/Cargo.toml
./test_support/src/lib.rs
The test_support
crate is a private testing support library for the other crate; it won't be published. As such, I haven't bothered to give it complete metadata, and I have
[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" }
cargo-common-metadata = { level = "allow", priority = 1 }
in its Cargo.toml
. The my_package
crate, on the other hand, has just
[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" }
because I do want to get dinged if I leave something out of that one.
... But this doesn't work. Clippy rejects the test_support
crate for not having complete metadata, unless I add the cargo-common-metadata
allow line to my_package/Cargo.toml
as well.
Why doesn't it work to have cargo-common-metadata = { level = "allow", priority = 1 }
in just one of the two crates' Cargo.toml
?
Is this not the appropriate way to handle a crate with a private test-only dependency that won't be published, and if so, what is the appropriate way to handle such a situation?
complete (redacted) Cargo.toml
[workspace]
resolver = "2"
members = ["test_support", "my_project"]
default-members = ["my_project"]
[workspace.package]
authors = [ ... ]
repository = "..."
readme = "README.md"
license = "..."
edition = "2021"
# oldest version in which 2021 ed. is stable;
# 1.60 required for unit tests only, because of proptest
rust-version = "1.56"
[workspace.dependencies]
proptest = "1.2.0"
complete (redacted) my_project/Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
description = "..."
categories = [ ... ]
keywords = [ ... ]
authors.workspace = true
repository.workspace = true
readme.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
[dev-dependencies]
proptest.workspace = true
test_support.path = "../test_support"
[lints.rust]
warnings = { level = "deny" }
[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" }
complete (redacted) test_support/Cargo.toml
[package]
name = "test_support"
version = "0.0.1-private"
description = "Testing support code for my_project"
authors.workspace = true
repository.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
[dependencies]
proptest.workspace = true
[lints.rust]
warnings = { level = "deny" }
[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" }
cargo-common-metadata = { level = "allow", priority = 1 }