From 1120f1f6f77f37b9fe6d203a56539e7580b40d2c Mon Sep 17 00:00:00 2001 From: Hrvoje Niksic Date: Tue, 15 Sep 2020 23:52:52 +0200 Subject: [PATCH] Cosmetic changes. --- src/builder.rs | 4 ++-- src/communicate.rs | 12 ++++++------ src/popen.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 4cb331e..095bfca 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -202,7 +202,7 @@ mod exec { /// When this is invoked, the subprocess will not inherit the /// environment of this process. pub fn env_clear(mut self) -> Exec { - self.config.env = Some(Vec::new()); + self.config.env = Some(vec![]); self } @@ -1033,7 +1033,7 @@ mod pipeline { impl fmt::Debug for Pipeline { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let mut args = Vec::new(); + let mut args = vec![]; for cmd in &self.cmds { args.push(cmd.to_cmdline_lossy()); } diff --git a/src/communicate.rs b/src/communicate.rs index 45c6c99..1024dad 100644 --- a/src/communicate.rs +++ b/src/communicate.rs @@ -185,8 +185,8 @@ mod raw { deadline: Option, size_limit: Option, ) -> (Option, (Option>, Option>)) { - let mut outvec = Vec::::new(); - let mut errvec = Vec::::new(); + let mut outvec = vec![]; + let mut errvec = vec![]; let err = self .read_into(deadline, size_limit, &mut outvec, &mut errvec) @@ -249,7 +249,7 @@ mod raw { } } - fn spawn_curried(f: impl FnOnce(T) + Send + 'static, arg: T) { + fn spawn_with_arg(f: impl FnOnce(T) + Send + 'static, arg: T) { thread::spawn(move || f(arg)); } @@ -294,9 +294,9 @@ mod raw { let (tx, rx) = mpsc::sync_channel(0); - read_stdout.map(|f| spawn_curried(f, tx.clone())); - read_stderr.map(|f| spawn_curried(f, tx.clone())); - write_stdin.map(|f| spawn_curried(f, tx.clone())); + read_stdout.map(|f| spawn_with_arg(f, tx.clone())); + read_stderr.map(|f| spawn_with_arg(f, tx.clone())); + write_stdin.map(|f| spawn_with_arg(f, tx.clone())); RawCommunicator { rx, diff --git a/src/popen.rs b/src/popen.rs index 02df37d..30de3a3 100644 --- a/src/popen.rs +++ b/src/popen.rs @@ -1159,7 +1159,7 @@ mod os { } fn assemble_cmdline(argv: Vec) -> io::Result { - let mut cmdline = Vec::::new(); + let mut cmdline = vec![]; let mut is_first = true; for arg in argv { if !is_first {