diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-20 18:34:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-20 18:34:54 +0900 |
| commit | 81b9fc9d92bb74aa8428ae4db39bd84e8c16095c (patch) | |
| tree | 3efb6476d797e2a95545c4c3abba468c3e3c8d52 /crates/shirabe/src/util/process_executor.rs | |
| parent | c09cd630afb4bb0ca10e926f93bf706ca828ae85 (diff) | |
| download | php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.gz php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.zst php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.zip | |
refactor(php-shim): drop Box wrapping from PhpMixed List/Array
The List and Array variants of PhpMixed boxed their elements
unnecessarily. Store PhpMixed values directly and update all callers
accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/process_executor.rs')
| -rw-r--r-- | crates/shirabe/src/util/process_executor.rs | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs index ca31290..2bdf065 100644 --- a/crates/shirabe/src/util/process_executor.rs +++ b/crates/shirabe/src/util/process_executor.rs @@ -149,7 +149,7 @@ impl ProcessExecutor { let cmd = PhpMixed::List( command .iter() - .map(|s| Box::new(PhpMixed::String(s.clone()))) + .map(|s| PhpMixed::String(s.clone())) .collect(), ); let mut buf = PhpMixed::String(String::new()); @@ -352,9 +352,9 @@ impl ProcessExecutor { git_env.insert("GIT_DIR".to_string(), cwd.unwrap().to_string()); self.run_process( PhpMixed::List(vec![ - Box::new(PhpMixed::String("git".to_string())), - Box::new(PhpMixed::String("config".to_string())), - Box::new(PhpMixed::String("safe.bareRepository".to_string())), + PhpMixed::String("git".to_string()), + PhpMixed::String("config".to_string()), + PhpMixed::String("safe.bareRepository".to_string()), ]), cwd, Some(git_env.clone()), @@ -677,7 +677,7 @@ impl ProcessExecutor { } else if let PhpMixed::List(list) = command { let parts: Vec<String> = array_map( |v| Self::escape(v.as_string().unwrap_or("")), - &list.iter().map(|b| (**b).clone()).collect::<Vec<_>>(), + &list.iter().cloned().collect::<Vec<_>>(), ); implode(" ", &parts) } else { @@ -810,7 +810,7 @@ impl ProcessExecutor { &PhpMixed::List( Self::BUILTIN_CMD_COMMANDS .iter() - .map(|s| Box::new(PhpMixed::String(s.to_string()))) + .map(|s| PhpMixed::String(s.to_string())) .collect(), ), true, @@ -870,21 +870,13 @@ impl IntoExecCommand for &String { impl IntoExecCommand for Vec<String> { fn into_exec_command(self) -> PhpMixed { - PhpMixed::List( - self.into_iter() - .map(|s| Box::new(PhpMixed::String(s))) - .collect(), - ) + PhpMixed::List(self.into_iter().map(PhpMixed::String).collect()) } } impl IntoExecCommand for &Vec<String> { fn into_exec_command(self) -> PhpMixed { - PhpMixed::List( - self.iter() - .map(|s| Box::new(PhpMixed::String(s.clone()))) - .collect(), - ) + PhpMixed::List(self.iter().map(|s| PhpMixed::String(s.clone())).collect()) } } @@ -892,7 +884,7 @@ impl<const N: usize> IntoExecCommand for &[&str; N] { fn into_exec_command(self) -> PhpMixed { PhpMixed::List( self.iter() - .map(|s| Box::new(PhpMixed::String(s.to_string()))) + .map(|s| PhpMixed::String(s.to_string())) .collect(), ) } @@ -902,7 +894,7 @@ impl IntoExecCommand for &[&str] { fn into_exec_command(self) -> PhpMixed { PhpMixed::List( self.iter() - .map(|s| Box::new(PhpMixed::String(s.to_string()))) + .map(|s| PhpMixed::String(s.to_string())) .collect(), ) } @@ -910,11 +902,7 @@ impl IntoExecCommand for &[&str] { impl IntoExecCommand for &[String] { fn into_exec_command(self) -> PhpMixed { - PhpMixed::List( - self.iter() - .map(|s| Box::new(PhpMixed::String(s.clone()))) - .collect(), - ) + PhpMixed::List(self.iter().map(|s| PhpMixed::String(s.clone())).collect()) } } |
