Rules / TAU-E001
Never ignore a result
decided by Rustc kernel deny core deny edge deny
Applies to tests: yes
Exceptions:
#[expect] + reasonWhy
Dropping a Result or discarding the original error is how failures go silent.
Fix
Propagate with ?, handle the error, or wrap it with context (.map_err(|e| MyError::Io(e))) instead of discarding it.
What it checks
Lints: unused_must_use, clippy::map_err_ignore
Seen in fixtures
rej-ignored-result/src/lib.rs core
//! Ignored result. /// Fallible step.////// # Errors/// Always fails.pub const fn step() -> Result<(), u8> { Err(1)} /// Caller that drops the error.pub fn run() { step();}$ cargo tauten check
error[TAU-E001]: unused `std::result::Result` that must be used --> rej-ignored-result/src/lib.rs:13:5 (core crate `rej-ignored-result`) = rule: Never ignore a result (decided by Rustc) = fix: Propagate with `?`, handle the error, or wrap it with context (`.map_err(|e| MyError::Io(e))`) instead of discarding it.rej-ignored-result (core) expects TAU-E001. Output captured at 0200db3.rej-test-hygiene/src/lib.rs core
//! Test code: relaxed rules apply, result hygiene does not. /// Fallible step.////// # Errors/// Never in practice.pub const fn step() -> Result<u8, u8> { Ok(1)} #[cfg(test)]mod tests { use super::step; #[test] fn relaxed_rules_do_not_apply() -> Result<(), std::io::Error> { let dir = std::env::temp_dir().join("tauten-fixture"); std::fs::create_dir_all(&dir)?; let n = [1_u8, 2][0] + 1; assert_eq!(n, 2); println!("{n}"); Ok(()) } #[test] fn explicit_discard_is_allowed_in_tests() { let _ = step(); } #[test] fn silent_drop_still_counts() { step(); }}$ cargo tauten check
error[TAU-E001]: unused `std::result::Result` that must be used --> rej-test-hygiene/src/lib.rs:32:9 (core crate `rej-test-hygiene`) = rule: Never ignore a result (decided by Rustc) = fix: Propagate with `?`, handle the error, or wrap it with context (`.map_err(|e| MyError::Io(e))`) instead of discarding it.rej-test-hygiene (core) expects TAU-E001. Output captured at 0200db3.In the terminal
cargo tauten explain TAU-E001$ cargo tauten explain TAU-E001
TAU-E001: Never ignore a result Why: Dropping a Result or discarding the original error is how failures go silent. Fix: Propagate with `?`, handle the error, or wrap it with context (`.map_err(|e| MyError::Io(e))`) instead of discarding it. Decided by: RustcDecides: No `#[must_use]` value (a `Result`) dropped silently.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: yesExceptions allowed: with #[expect(.., reason)] kernel deny core deny edge denyLints: unused_must_use, clippy::map_err_ignore