mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
17 lines
366 B
Rust
17 lines
366 B
Rust
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||
|
|
||
|
use std::convert::Infallible;
|
||
|
|
||
|
pub trait InfallibleResultExt<T> {
|
||
|
fn unwrap_infallible(self) -> T;
|
||
|
}
|
||
|
|
||
|
impl<T> InfallibleResultExt<T> for Result<T, Infallible> {
|
||
|
fn unwrap_infallible(self) -> T {
|
||
|
match self {
|
||
|
Ok(value) => value,
|
||
|
Err(never) => match never {},
|
||
|
}
|
||
|
}
|
||
|
}
|