From 8839eb0af47b99511956d81a6dbb32e948d2076c Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Mon, 17 Apr 2023 23:36:04 +0300 Subject: Fix unwrap bug in DAP (#6786) --- helix-dap/src/client.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'helix-dap/src/client.rs') 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))), } } -- cgit v1.2.3-70-g09d2