diff options
author | Blaž Hrastnik | 2021-11-07 09:37:42 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-07 09:38:04 +0000 |
commit | 9baddc825d57e09e635b653b2c171e104f85c552 (patch) | |
tree | 58ce5c257db1a0216bda5fbd4119c4f152cbf372 /helix-dap | |
parent | fd9b826f2c124ce1983191dd632f3e9ca37ba74c (diff) |
dap: Get rid of excessive cloning
Diffstat (limited to 'helix-dap')
-rw-r--r-- | helix-dap/src/client.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 28cc7c90..5e6d8d53 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -42,25 +42,19 @@ pub struct Client { impl Client { // Spawn a process and communicate with it by either TCP or stdio pub async fn process( - transport: String, - command: String, - args: Vec<String>, - port_arg: Option<String>, + transport: &str, + command: &str, + args: Vec<&str>, + port_arg: Option<&str>, id: usize, ) -> Result<(Self, UnboundedReceiver<Payload>)> { 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.iter().map(|s| s.as_str()).collect(), - &port_arg.unwrap(), - id, - ) - .await + Self::tcp_process(command, args, port_arg.unwrap(), id).await } else if transport == "stdio" { - Self::stdio(&command, args.iter().map(|s| s.as_str()).collect(), id) + Self::stdio(command, args, id) } else { Result::Err(Error::Other(anyhow!("Incorrect transport {}", transport))) } |