aboutsummaryrefslogtreecommitdiff
path: root/helix-dap/src/client.rs
diff options
context:
space:
mode:
authorA-Walrus2023-04-17 20:36:04 +0000
committerGitHub2023-04-17 20:36:04 +0000
commit8839eb0af47b99511956d81a6dbb32e948d2076c (patch)
tree91c19ea13a5a7de4731c37e9cc728a30c177fb63 /helix-dap/src/client.rs
parent1b016a89d546fb84d3c737d7c4bacb9e26c8b893 (diff)
Fix unwrap bug in DAP (#6786)
Diffstat (limited to 'helix-dap/src/client.rs')
-rw-r--r--helix-dap/src/client.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs
index 7efb72d8..acdfc5b7 100644
--- a/helix-dap/src/client.rs
+++ b/helix-dap/src/client.rs
@@ -62,12 +62,10 @@ impl Client {
if command.is_empty() {
return Result::Err(Error::Other(anyhow!("Command not provided")));
}
- if transport == "tcp" && port_arg.is_some() {
- Self::tcp_process(command, args, port_arg.unwrap(), id).await
- } else if transport == "stdio" {
- Self::stdio(command, args, id)
- } else {
- Result::Err(Error::Other(anyhow!("Incorrect transport {}", transport)))
+ match (transport, port_arg) {
+ ("tcp", Some(port_arg)) => Self::tcp_process(command, args, port_arg, id).await,
+ ("stdio", _) => Self::stdio(command, args, id),
+ _ => Result::Err(Error::Other(anyhow!("Incorrect transport {}", transport))),
}
}