From 9baddc825d57e09e635b653b2c171e104f85c552 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sun, 7 Nov 2021 18:37:42 +0900 Subject: dap: Get rid of excessive cloning --- helix-dap/src/client.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'helix-dap') 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, - port_arg: Option, + transport: &str, + command: &str, + args: Vec<&str>, + port_arg: Option<&str>, id: usize, ) -> Result<(Self, UnboundedReceiver)> { 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))) } -- cgit v1.2.3-70-g09d2