Created
November 19, 2025 14:16
-
-
Save jeromegn/9f053088ed6a1193a4271b91e14fd979 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![deny(clippy::unwrap_used)] | |
| fn main() { | |
| Err::<(), _>("foo").or_panic() | |
| } | |
| trait UnwrapPanic<T> { | |
| fn or_panic(self) -> T; | |
| } | |
| impl<T, E> UnwrapPanic<T> for Result<T, E> where E: std::fmt::Debug { | |
| fn or_panic(self) -> T { | |
| #[allow(clippy::unwrap_used)] | |
| self.unwrap() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment