Skip to content

Proposal: Moving lints to workspace Cargo.toml

Hi, i just started familiarizing myself with the codebase but the thing that struck me the most was using the maint/add_arnings script for applying rust lint rules.

Proposal

My proposal is to simply move the main lints into the workspace Cargo.toml file and ensure and check against lints.workspace = true rather than running ci to ensure lint synchronization.

I have already done some digging into the topic workspace lints discussion, global lint config discussion

From what I've seen so far there are some things, such as test specific lints, would need to be configured with e.g.#![cfg_attr(test)] (from this discussion post ).

In my opinion even just moving the core warning lints to the workspace Cargo.toml would be beneficial, as only lints.workspace = true is required to keep the dependency list synchronized with the global lint list.

Furthermore i think this would allow flexibility in denying or allowing specific lints to specific crates more on an exception based system.

For issues with different flags on ci stable or nightly builds could be kept in the script or used with a single rust compilation flag like RUSTFLAGS=-Aunknown_lints for stable and RUSTFLAGS=-Arenamed_and_removed_lints.

Additionally this use could also lead to allowing development with denying cargo lints and forcing them to warn on compilation for older verisons (RUSTFLAGS= -Werror or --cap-lints as deny allows override)

Would love some feedback on this, and looking forward to trying to implement this on the rust side if accepted!

Edited by Mateusz