Re:Using unwrap() in Rust is Okay (2022)
by m00dy on Wednesday May 21, 2025 @06:58AM
(#44050166)
I only use unwrap in tests
[ Parent
| on HN ]
I use expect() so that I can grep for instances of "unwrap()" after the prototyping phase without getting tests.
Re:Using unwrap() in Rust is Okay (2022)
by theodorton on Wednesday May 21, 2025 @10:13AM
(#44051674)
You can add
[lints.clippy]
unwrap_used = "deny"
to Cargo.toml if you want to avoid unwrap and then explicitly opt-in with #[allow(clippy::unwrap_used)]