-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 |
Adding some thoughts as a casual user of Recently, I heard that support has been added for configuring lints on the package and workspace level. For a new repository, I decided to give this a try, in order to avoid repeating myself in the workspace member packages. Figuring out how to do this turned out to be non-obvious. First I opened the documentation for configuring clippy. Based on the instructions at the top of the page, I tried to use a Second, I tried to figure out how the configuration would work from a workspace Third, I tried to verify that the workspace configuration for the lints would work. I deliberately added some code that These stumbling blocks are perhaps "papercut bugs" - not very serious, and possible to learn your way out of with half an hour of searching and reading. However, I feel like maybe some user experience improvements could be possible. Finally, I hope reporting these negative experiences is not taken too harshly - Footnotes
|
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: