Skip to content

M0024 workspace-lints

Rule: The root declares [workspace.lints] and every member inherits them.

Code M0024 (stable, never reused)
Id workspace-lints
Category workspace
Source spirit_level
Fix exact: spl check --fix applies it

Level per tier

Tier Level Reason
small off
small-workspace deny every crate inherits [workspace.lints], so one table is the policy
medium deny every crate inherits [workspace.lints], so one table is the policy
big deny every crate inherits [workspace.lints], so one table is the policy
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

One [workspace.lints] table is the project's lint policy; every crate opts in with [lints] workspace = true. A crate without that line silently runs with no policy at all (rerun's lint.py and zed's package-conformity both fail on it).

How to fix

Declare [workspace.lints.rust] and [workspace.lints.clippy] in the root manifest. spl check --fix appends [lints] with workspace = true to each member that has no [lints] table.

Crates the map marks unsafe

Cargo takes [lints] workspace = true or a table of the crate's own, never both, and a crate cannot loosen an inherited forbid. So a crate the map marks unsafe = true (see unsafe-allow-list) copies [workspace.lints] into its own [lints], with unsafe_code set to deny or allow. The lint then checks the copy: every other workspace lint at the same level and priority.

Configure

[lints.workspace-lints]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(workspace-lints) <reason> (waivers); the code works there too, as in [lints.M0024].