Rules / TAU-X001
Lint exceptions must be #[expect] with a reason
#[expect] + reasonWhy
#[allow] silently outlives the code it excused. #[expect(lint, reason = "...")] documents why and fails once the exception is no longer needed.
Fix
Replace #[allow(x)] with #[expect(x, reason = "why this is safe here")] on the smallest item possible, or fix the code. A module compiled into several targets (helpers under tests/ declared with mod support; by several test files) cannot carry an inner #![expect]: it is unfulfilled in every target where the lint does not fire. For dead_code only, it may carry #![allow(dead_code, reason = "...")]. Otherwise put #[expect(x, reason = "...")] on the mod declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (tests/it/main.rs with the tests as modules), or a support crate used as a dev-dependency.
What it checks
Lints: clippy::allow_attributes, clippy::allow_attributes_without_reason, unfulfilled_lint_expectations
Seen in fixtures
rej-allow/src/lib.rs core
//! `#[allow]` instead of `#[expect]` with a reason. /// Parse a port.#[allow(clippy::unwrap_used)]#[must_use]pub fn port(text: &str) -> u16 { text.parse().unwrap()}$ cargo tauten check
error[TAU-X001]: `allow` attribute without specifying a reason --> rej-allow/src/lib.rs:4:1 (core crate `rej-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. error[TAU-X001]: #[allow] attribute found --> rej-allow/src/lib.rs:4:3 (core crate `rej-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency.rej-allow (core) expects TAU-X001. Output captured at 0200db3.rej-cfg-attr-allow/src/lib.rs core
//! An `allow` hidden in `cfg_attr`: in force only outside tests. /// The first byte.#[cfg_attr(not(test), allow(clippy::unwrap_used))]#[must_use]pub fn first(bytes: &[u8]) -> u8 { *bytes.first().unwrap()}$ cargo tauten check
error[TAU-X001]: `cfg_attr(.., allow(clippy::unwrap_used))`: use `expect(clippy::unwrap_used, reason = "...")`, or narrow it to the item that needs it --> rej-cfg-attr-allow/src/lib.rs:4:1 (core crate `rej-cfg-attr-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. error[TAU-X001]: #[allow] attribute found --> rej-cfg-attr-allow/src/lib.rs:4:23 (core crate `rej-cfg-attr-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. error[TAU-X001]: `allow` attribute without specifying a reason --> rej-cfg-attr-allow/src/lib.rs:4:23 (core crate `rej-cfg-attr-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency.rej-cfg-attr-allow (core) expects TAU-X001. Output captured at 0200db3.rej-file-allow/src/lib.rs kernel
//! A file-level allow instead of a reasoned `#![expect]`.#![no_std]#![allow(clippy::needless_return, reason = "style")] /// One.#[must_use]pub const fn one() -> u8 { return 1;}$ cargo tauten check
error[TAU-X001]: file-level `#![allow(clippy::needless_return)]`: use `expect(clippy::needless_return, reason = "...")`, or narrow it to the item that needs it --> rej-file-allow/src/lib.rs:3:1 (kernel crate `rej-file-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency.rej-file-allow (kernel) expects TAU-X001. Output captured at 0200db3.rej-shared-test-allow/src/lib.rs core
//! Something for the tests to exercise. /// Twice the input, saturating.#[must_use]pub const fn double(x: u32) -> u32 { x.saturating_mul(2)}$ cargo tauten check
error[TAU-X001]: `allow` attribute without specifying a reason --> rej-shared-test-allow/tests/support/mod.rs:2:1 (core crate `rej-shared-test-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. error[TAU-X001]: file-level `#![allow(dead_code)]`: use `expect(dead_code, reason = "...")` on the item that needs it; for a module compiled into several targets (shared test helpers), put it on the `mod` declaration in each target where the lint fires --> rej-shared-test-allow/tests/support/mod.rs:2:1 (core crate `rej-shared-test-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. error[TAU-X001]: file-level `#![allow(dead_code)]`: use `expect(dead_code, reason = "...")`, or narrow it to the item that needs it --> rej-shared-test-allow/tests/two.rs:2:1 (core crate `rej-shared-test-allow`) = rule: Lint exceptions must be `#[expect]` with a reason (decided by Clippy) = fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency.rej-shared-test-allow (core) expects TAU-X001. Output captured at 0200db3.In the terminal
cargo tauten explain TAU-X001$ cargo tauten explain TAU-X001
TAU-X001: Lint exceptions must be `#[expect]` with a reason Why: `#[allow]` silently outlives the code it excused. `#[expect(lint, reason = "...")]` documents why and fails once the exception is no longer needed. Fix: Replace `#[allow(x)]` with `#[expect(x, reason = "why this is safe here")]` on the smallest item possible, or fix the code. A module compiled into several targets (helpers under `tests/` declared with `mod support;` by several test files) cannot carry an inner `#![expect]`: it is unfulfilled in every target where the lint does not fire. For `dead_code` only, it may carry `#![allow(dead_code, reason = "...")]`. Otherwise put `#[expect(x, reason = "...")]` on the `mod` declaration in exactly the targets where it fires, or remove the sharing: one integration-test target per crate (`tests/it/main.rs` with the tests as modules), or a support crate used as a dev-dependency. Decided by: ClippyDecides: Every lint exception is `#[expect]` with a reason, except a reasoned file-level `#![allow(dead_code)]` in a module under `tests/` or `benches/` that is not the root of a Cargo target (RFC 2026-11-21-shared-test-module-allow).Sees: resolved; complete: yesDoes not see: Code expanded from macros defined in other crates (clippy skips it). Inner attributes and `allow` inside `cfg_attr` are read by tauten itself, in `src/`, `tests/`, `benches/`, `examples/` and the build script. The accepted shared-test-module `allow(dead_code)` is decided by that scan and Cargo's target list, not by the compiler: it never fails once no target needs it, so a helper no target uses goes unreported.Applies to tests: yesExceptions allowed: with #[expect(.., reason)] kernel deny core deny edge denyLints: clippy::allow_attributes, clippy::allow_attributes_without_reason, unfulfilled_lint_expectations