-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expect lints.workspace = true
for crates in a workspace with a [workspace.lints]
section
#11933
Comments
Oh my gosh, I thought/hoped that this is implicitly on without having to opt in for every workspace member crate. 😱 |
I 100% want this lint, but with one small modification
I think the lint should enforce that all crates in the workspace has |
@emilk that would be great, but currently setting |
So one one about this, you do not inherit from One way to reframe an opt-out to not require |
What it does
If your workspace has a
[lints]
table specifying lints, then this lint checks that thelints.workspace = true
value is set in theCargo.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
orpedantic
, but one of those feels right).Example
If the workspace
Cargo.toml
has:And the package
Cargo.toml
is missing aThen we can add it for them.
The text was updated successfully, but these errors were encountered: