You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, cargo maintainers are very cautious as to what warnings are created because they cannot be turned off by the user when they are intended. The problem is we've not had a mechanism to control it. With #12115, we'll now have a mechanism
Lints for unstable features (made difficult by lack of runtime iteration of -Z) (what should be the behavior of lints for runtime controlled unstable features like hint-mostly-unused, always run or only with -Z)
No, at All Hands we decided that Cargo should operate on its own lints only
Where should workspace-level lints run? On the workspace or on each package?
Run them on the workspace, subject to the workspace.lints (with a sometimes fallback to lints similar to *.resolver)
Notes
There will still be lints that are not related to the package but related to the user or / invocation. At a later stage, we can consider user-level lint levels.
Showing lint reason once per package:
When inherited, we could potentially show it once per workspace just like rustc would do for a crate level attribute
Starting with this now as an MVP, we can always re-evaluate later
Deferred reducing boilerplate
Deferred json messages
Deferred: whether to make lint docs more like clippy
Out of scope: CLI control. That would be evaluated for [lints] as a whole, potentially through config. Note that existing runtime lint control is not officially supported in Cargo but done through an escape hatch
Problem
Today, cargo maintainers are very cautious as to what warnings are created because they cannot be turned off by the user when they are intended. The problem is we've not had a mechanism to control it. With #12115, we'll now have a mechanism
Turning existing warnings into lints:
[patch]inconfig.tomltriggers unhelpful warnings #11782cargo publish#7380Cargo.tomlwarnings into errors #2568warning: doc tests are not supported for crate type(s) cdylibeven with explicitdoctest = false#15964Porting clippy lints to cargo
Examples of new lints:
cargo publishshould warn on invalid categories/keywords #4300rerun-if-changed=PATHandPATHpoints to none-existing file #6003core#7760[lib]and[package]when publishing #6827package.homepage(see Add guidance on setting homepage in manifest #13293)includepatterns should report invalid paths #14390cargo packagecargo package(and publish) includestargetfolder #15398 (comment)Proposed Solution
As package and workspace level lint control, turning existing warnings into diagnostics where possible
Tasks
Cargo.toml(feat: Addrustcstyle errors for manifest parsing #13172)im_a_teapotlint should be unstable (see Cleanup linting system #13797 for context) (implemented in Error when unstable lints are specified but not enabled #13805)rustcandclippy(see Add tooling to document lints #14025)text-direction-codepoint-in-commentlint #16374, Addtext-direction-codepoint-in-literallint #16373package.homepage#15871build.warningscontrol (feat(diag): Supportbuild.warningsfor cargo lints #17112)unwrapunused_workspace_dependencies#16982-Z) (what should be the behavior of lints for runtime controlled unstable features likehint-mostly-unused, always run or only with-Z)Snippet(e.g. in-memory manifests), at least provide anOriginunused_dependencies(feat(lints): Emit unused_dependencies lint #16600). Started with anignored = ["dep_name], then ignoringdirect & transitive(fix(compile): Ignore unused deps if also transitive #16935, Revert "feat(lints): Add unused deps ignore list" #16937)Non-blocking
Cargo.lock.cargo/config.tomlrust_2024_compatibilitylint group #13740 skipped it for 2024)Cargo.toml(ie port warnings off ofshell.warnfor consistency)Rejected
_::warningsdynamic group (rustorcargo?): specialized warning for specific workflows that is being superseded by other mechanismsOpen questions
workspace.lints(with a sometimes fallback tolintssimilar to*.resolver)Notes
There will still be lints that are not related to the package but related to the user or / invocation. At a later stage, we can consider user-level lint levels.
Showing lint reason once per package:
Deferred reducing boilerplate
Deferred json messages
Deferred: whether to make lint docs more like clippy
Out of scope: CLI control. That would be evaluated for
[lints]as a whole, potentially through config. Note that existing runtime lint control is not officially supported in Cargo but done through an escape hatch