Rules / TAU-X002

No crate-wide exceptions to profile lints

decided by Tauten kernel deny core deny edge deny
Applies to tests: yes Exceptions: never

Why

A crate-level #![expect(...)] or #![allow(...)] of a profile lint switches the rule off for the whole crate.

Fix

Move the exception to the single item that needs it, with a reason.

Seen in fixtures

rej-crate-wide/src/lib.rs core

#![expect(clippy::unwrap_used, reason = "crate-wide opt-out")]//! Crate-wide opt-out of a profile rule. /// Parse a port.#[must_use]pub fn port(text: &str) -> u16 {    text.parse().unwrap()}

$ cargo tauten check

error[TAU-X002]: crate-wide exception for `clippy::unwrap_used` (TAU-P001)  --> rej-crate-wide/src/lib.rs:1:1 (core crate `rej-crate-wide`)  = rule: No crate-wide exceptions to profile lints (decided by Tauten)  = fix: Move the exception to the single item that needs it, with a reason.
Fixture rej-crate-wide (core) expects TAU-X002. Output captured at 0200db3.

In the terminal

cargo tauten explain TAU-X002

$ cargo tauten explain TAU-X002

TAU-X002: No crate-wide exceptions to profile lints Why: A crate-level `#![expect(...)]` or `#![allow(...)]` of a profile lint switches the rule off for the whole crate. Fix: Move the exception to the single item that needs it, with a reason. Decided by: TautenDecides: No crate-level `#![allow]`/`#![expect]` of a profile lint.Sees: source; complete: yesDoes not see: Attributes and items produced by macros. Read in `src/`, `tests/`, `benches/`, `examples/` and the build script, including inside `cfg_attr`; a lint group counts as every profile rule it may contain (an over-approximation).Applies to tests: yesExceptions allowed: with #[expect(.., reason)]  kernel deny  core deny  edge deny