Rules / TAU-P001

No unwrap/expect on fallible values

decided by Clippy kernel deny core deny edge deny
Applies to tests: no Exceptions: #[expect] + reason

Why

unwrap/expect turn every unexpected input into a crash, and agents use them to silence the type checker instead of handling the case.

Fix

Propagate with ? and a typed error, or handle the None/Err case explicitly with match, if let, or a default chosen on purpose.

What it checks

Lints: clippy::unwrap_used, clippy::expect_used, clippy::get_unwrap

Seen in fixtures

rej-unwrap/src/lib.rs core

//! Unwrap on input. /// Parse a port.#[must_use]pub fn port(text: &str) -> u16 {    text.parse().unwrap()}

$ cargo tauten check

error[TAU-P001]: used `unwrap()` on a `Result` value  --> rej-unwrap/src/lib.rs:6:5 (core crate `rej-unwrap`)  = rule: No unwrap/expect on fallible values (decided by Clippy)  = fix: Propagate with `?` and a typed error, or handle the None/Err case explicitly with match, if let, or a default chosen on purpose.
Fixture rej-unwrap (core) expects TAU-P001. Output captured at 0200db3.

In the terminal

cargo tauten explain TAU-P001

$ cargo tauten explain TAU-P001

TAU-P001: No unwrap/expect on fallible values Why: unwrap/expect turn every unexpected input into a crash, and agents use them to silence the type checker instead of handling the case. Fix: Propagate with `?` and a typed error, or handle the None/Err case explicitly with match, if let, or a default chosen on purpose. Decided by: ClippyDecides: No `unwrap`/`expect` call on a fallible value in linted code.Sees: resolved; complete: yesDoes not see: Code expanded from macros defined in other crates (clippy skips it); code disabled by `cfg`; build scripts.Applies to tests: noExceptions allowed: with #[expect(.., reason)]  kernel deny  core deny  edge denyLints: clippy::unwrap_used, clippy::expect_used, clippy::get_unwrap