Skip to main content

hyper/common/
lock.rs

1use std::sync::LockResult;
2
3pub(crate) trait LockResultExt<T> {
4    fn panic_if_poisoned(self) -> T;
5}
6
7#[allow(clippy::panic)]
8impl<T> LockResultExt<T> for LockResult<T> {
9    #[track_caller]
10    fn panic_if_poisoned(self) -> T {
11        match self {
12            Ok(inner) => inner,
13            Err(err) => panic!("lock poisoned by panic: {err}"),
14        }
15    }
16}