Hello,
I wish to override the workspace.lints from the workspace in sub crates.
I found this.
Is there a workaround ?
Thank you very much in advance for any help
Hello,
I wish to override the workspace.lints from the workspace in sub crates.
I found this.
Is there a workaround ?
Thank you very much in advance for any help
There is no cargo-level way to do it yet. [lints] workspace = true is all or nothing — if you add any key next to it in the package you get
cannot override `workspace.lints` in `lints`, either remove the overrides or `lints.workspace = true` and manually specify the lints
This is by design — RFC 3389 says "it is a hard error to mix workspace = true and lints" (3389-manifest-lint - The Rust RFC Book).
Two workarounds that work today (checked on 1.98 on my machine):
Put the override in the crate root instead of Cargo.toml: #![allow(some_lint)] or #![warn(...)] at the top of lib.rs / main.rs. Cargo passes workspace lints to rustc as -A/-W/-D flags, and source attributes take precedence over command-line flags, so a workspace deny can be relaxed to allow in that one crate this way.
Drop workspace = true in that crate and write its full [lints.rust] / [lints.clippy] table by hand. Then the workspace table is ignored entirely for that package, so you have to restate everything you still want.
1 is less duplication. 2 is better if the crate really wants a different policy. priority doesn't help here, it only orders lints within a single table.
~Cheers
Please don't post machine-generated text verbatim here on URLO. It is against the ToS.
Well I tested it on my machine , but yeah was trying to just to save some formatting time I used , will surely take an effort to format it my self
Thank you !