-
Notifications
You must be signed in to change notification settings - Fork 506
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
Deny rust_2018_idioms
and unused_qualifications
in crate roots
#2739
Comments
Happy to tighten this up if there's a way to do so without adding more attributes to the various crates. Perhaps with a clippy config file, like Note that the warning about the "unused extern crate" is a false positive and it is in fact needed. |
rust_2018_idioms
in crate rootsrust_2018_idioms
and unused_qualifications
in crate roots
Most are valid, especially in the custom |
Exactly that exists in the latest 1.74 Rust release: https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#lint-configuration-through-cargo It has one fatal flaw, which is having to opt-in every crate manually. That might work for windows-rs as there are not many crates and it's relatively easy to audit (and you probably don't care about having strict linting on most crates, like tools and tests. EDIT: On the other hand it improves readability, especially when tests are taken as examples). |
Lints set in a workspace will be inherited by every crate. |
Right you need to add |
For a workspace split across over 200 crates, with new ones being added on a weekly basis? |
Tbh, in that case I'd be minded to automate it. There's probably a bunch of boiler plate stuff you need in any case. But I admit I find that to be an unusual workflow, unless you're doing some kind of monorepo-like thing. |
Thanks, workspace lints works nicely - I'll roll that into #2740. |
Suggestion
When using a local
path
reference to thewindows-rs
crate, from a project that denies a bunch of lints globally (viarustflags
in.cargo/config.toml
until workspace lints get implicit/forced inheritance), there are quite a few warnings from thewindows
crate which would be trivial and neat to resolve.Most/all originate from the
rust_2018_idioms
lint (and a few more likeunused_qualifications
, I think https://github.com/ash-rs/ash/blob/e6d80badc389d94e2a747f442e5ed4189b66d7d3/ash/src/lib.rs#L1-L8 might be a good starting point). This lint isn't enabled by default despitewindows
already settingedition = "2021"
, and certain things likeextern crate
might be nice to clear out.Some samples:
The text was updated successfully, but these errors were encountered: