Skip to content

M0021 macro-crate-suffix

Rule: Proc-macro crates and only they end in _macros or _derive.

Code M0021 (stable, never reused)
Id macro-crate-suffix
Category workspace
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace warn _macros and _derive mean proc macros and nothing else
medium warn _macros and _derive mean proc macros and nothing else
big warn _macros and _derive mean proc macros and nothing else
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

_macros and _derive are reserved for proc-macro crates (Bevy, rerun): a reader knows from the name that the crate runs at compile time and has a compile-fail test crate beside it. A regular crate with such a name, or a proc-macro crate without one, breaks that.

How to fix

Rename the crate.

Configure

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

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