summaryrefslogtreecommitdiff
path: root/cli/util/result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/util/result.rs')
-rw-r--r--cli/util/result.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/util/result.rs b/cli/util/result.rs
new file mode 100644
index 000000000..3203d04eb
--- /dev/null
+++ b/cli/util/result.rs
@@ -0,0 +1,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 {},
+ }
+ }
+}