diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-04-06 22:43:16 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-04-06 22:43:16 +0200 |
commit | 13a59e98f950e4983e469a3c54e5bbb1cc5ef936 (patch) | |
tree | 8307879a9f7c6a8e292d9143ae7c584f158fc106 /src/opener.rs | |
parent | 6b3dda9eecb60b062125af950420d257460dc547 (diff) |
use &[] instead of &Vec in execute in child without check
Diffstat (limited to 'src/opener.rs')
-rw-r--r-- | src/opener.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/opener.rs b/src/opener.rs index b8080e0..2359244 100644 --- a/src/opener.rs +++ b/src/opener.rs @@ -409,16 +409,17 @@ pub fn execute_in_child_without_output(exe: &str, args: &[&str]) -> Result<std:: pub fn execute_in_child_without_output_with_path<P>( exe: &str, path: P, - args: Option<&Vec<&str>>, + args: Option<&[&str]>, ) -> Result<std::process::Child> where P: AsRef<Path>, { info!("execute_in_child_without_output_with_path. executable: {exe}, arguments: {args:?}",); - let mut params = &vec![]; - if let Some(args) = args { - params = args; - } + // let mut params = &[]; + // if let Some(args) = args { + // params = args; + // } + let params = if let Some(args) = args { args } else { &[] }; Ok(Command::new(exe) .stdin(Stdio::null()) .stdout(Stdio::null()) |