X0021 deny-licenses¶
Rule: Every crate's licence is one deny.toml allows.
| Code | X0021 (stable, never reused) |
| Id | deny-licenses |
| Category | deny |
| Source | cargo-deny (run as an executable) |
| Fix | by hand |
| Needs | cargo-deny installed |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | warn |
every linked licence is one the project accepts, listed once in deny.toml |
| big | deny |
every linked licence is one the project accepts, listed once in deny.toml |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Why¶
Every crate linked into the project brings its licence. deny.toml's [licenses] lists the ones the project accepts; a crate under another licence, or under none, is reported.
Without deny.toml, cargo-deny's default policy allows no licence at all, so every crate would be rejected; this lint reports that once, asking for the file, instead of once per crate.
How to fix¶
Add deny.toml with the [licenses] section above. With one in place, replace the crate or add its licence to allow when it is acceptable. A workspace crate states its own licence in Cargo.toml.
Configure¶
Allow one finding in the code with // spirit-level: allow(deny-licenses) <reason> (waivers); the code works there too, as in [lints.X0021].