use std::convert::Infallible; use super::{DebugInspect, Result}; use crate::error; pub trait UnwrapInfallible { fn unwrap_infallible(self) -> T; } impl UnwrapInfallible for Result { #[inline] fn unwrap_infallible(self) -> T { // SAFETY: Branchless unwrap for errors that can never happen. In debug // mode this is asserted. unsafe { self.debug_inspect_err(error::infallible).unwrap_unchecked() } } }