summaryrefslogtreecommitdiff
path: root/cli/util/result.rs
blob: 3203d04eb7d298ba08d2758d7d99cea7f53c749a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 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 {},
    }
  }
}