Use join over custom join code (#4548)

This commit is contained in:
Joseph T. Lyons 2022-02-18 20:07:11 -05:00 committed by GitHub
parent 3f14b75153
commit 28b5399fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 23 deletions

View File

@ -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::<String>();
cmd.pop();
cmd = cmd.replace("\n", " ").replace("\t", " ");
cmd
cmd.join(" ").replace("\n", " ").replace("\t", " ")
} else {
self.curr_proc.stat().comm.clone()
}

View File

@ -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::<String>();
cmd.pop();
cmd = cmd.replace("\n", " ").replace("\t", " ");
cmd
path.cmd.join(" ").replace("\n", " ").replace("\t", " ")
} else {
String::from("")
}