diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-05-09 13:49:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 13:49:10 -0700 |
commit | 19c0633a947f2ee28cc07b59c32322151779101d (patch) | |
tree | ab7983bf954cd109517f80b42bd3199eb27efaa4 /cli/util/result.rs | |
parent | 439b3b8db97106be44bb5fde9573632c20ed4e95 (diff) |
refactor(lsp): Have JS drive TSC event loop in LSP (#23565)
Diffstat (limited to 'cli/util/result.rs')
-rw-r--r-- | cli/util/result.rs | 16 |
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 {}, + } + } +} |