From 28b5399fb73f338a63c96a2586dbd6ec2a4201a3 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 18 Feb 2022 20:07:11 -0500 Subject: [PATCH] Use join over custom join code (#4548) --- crates/nu-system/src/linux.rs | 12 +----------- crates/nu-system/src/macos.rs | 13 +------------ 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/crates/nu-system/src/linux.rs b/crates/nu-system/src/linux.rs index 5432eed07b..cc07e05ed4 100644 --- a/crates/nu-system/src/linux.rs +++ b/crates/nu-system/src/linux.rs @@ -194,17 +194,7 @@ impl ProcessInfo { pub fn command(&self) -> String { if let Ok(cmd) = &self.curr_proc.cmdline() { if !cmd.is_empty() { - let mut cmd = cmd - .iter() - .cloned() - .map(|mut x| { - x.push(' '); - x - }) - .collect::(); - cmd.pop(); - cmd = cmd.replace("\n", " ").replace("\t", " "); - cmd + cmd.join(" ").replace("\n", " ").replace("\t", " ") } else { self.curr_proc.stat().comm.clone() } diff --git a/crates/nu-system/src/macos.rs b/crates/nu-system/src/macos.rs index db72450347..1d1839832b 100644 --- a/crates/nu-system/src/macos.rs +++ b/crates/nu-system/src/macos.rs @@ -316,18 +316,7 @@ impl ProcessInfo { pub fn command(&self) -> String { if let Some(path) = &self.curr_path { if !path.cmd.is_empty() { - let mut cmd = path - .cmd - .iter() - .cloned() - .map(|mut x| { - x.push(' '); - x - }) - .collect::(); - cmd.pop(); - cmd = cmd.replace("\n", " ").replace("\t", " "); - cmd + path.cmd.join(" ").replace("\n", " ").replace("\t", " ") } else { String::from("") }