Description
What it does
If your workspace has a [lints]
table specifying lints, then this lint checks that the lints.workspace = true
value is set in the Cargo.toml
of all packages in the workspace, to ensure that those lints are actually applied.
We also might want to check for the other workspace-inheritable things, but those should be separate lints since people might want to only enforce this for some of them, and I don't personally use any of them, so I'm less qualified to talk about that.
Advantage
Specifying lint levels once in the package workspace is nice, but it's easy to forget to add the corresponding field to the Cargo.toml
for each package member, which can result in extra lints specified in the package workspace silently not being applied. Having this lint will allow me to be confident that those lints are picked up in all of my packages.
See my post on URLO asking about how to check for this for the problem it solves.
Drawbacks
Some people might deliberately not inherit the workspace table for all lints, enough that I feel like allow-by-default is probably the play (idk if this belongs in cargo
or pedantic
, but one of those feels right).
Example
If the workspace Cargo.toml
has:
...
[workspace.lints.clippy]
# Unimportant what's here, just that something is set
# Also should apply if it's not clippy lints but some other linter
pedantic = "warn"
...
And the package Cargo.toml
is missing a
[lints]
workspace = true
Then we can add it for them.