Skip to content

A0007 lint-table-allow-reason

Rule: A lint allowed in a Cargo.toml [lints] table says why in a comment.

Code A0007 (stable, never reused)
Id lint-table-allow-reason
Category stop-gap
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai deny a lint allowed for a whole crate in Cargo.toml says why
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

A lint turned off in [lints] or [workspace.lints] of a Cargo.toml applies to the whole crate or workspace. Without a reason nobody knows whether it can be turned back on. #[allow] attributes in code are covered by allow-without-reason; this rule covers the manifests.

An entry whose level is allow (x = "allow" or x = { level = "allow", ... }) needs a # comment on its line or the line above.

[workspace.lints.clippy]
# the builder API takes many arguments by design
too_many_arguments = "allow"
module_name_repetitions = "allow"      <- reported

How to fix

Add the reason as a comment, or remove the entry.

Configure

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

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