M0008 feature-docs¶
Rule: Every cargo feature has a comment saying what it turns on.
| Code | M0008 (stable, never reused) |
| Id | feature-docs |
| Category | manifest |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | warn |
a feature without a comment cannot be chosen by a reader |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
skip |
list of strings | ["default"] |
features that need no comment |
Why¶
A cargo feature without a comment can only be understood by reading the code it gates. Bevy fails CI on a feature with no doc line; the comment above the feature is its documentation.
Example¶
How to fix¶
Put a # comment line right above each feature. Features in the parameter skip (by default default) need none.
Configure¶
[lints.feature-docs]
level = "deny"
skip = ["default"]
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(feature-docs) <reason> (waivers); the code works there too, as in [lints.M0008].