From 81b9fc9d92bb74aa8428ae4db39bd84e8c16095c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 18:34:54 +0900 Subject: 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) --- crates/shirabe/src/plugin/plugin_manager.rs | 17 ++++++----------- crates/shirabe/src/plugin/pre_file_download_event.rs | 6 +++--- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'crates/shirabe/src/plugin') diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs index da64cee..3d9c461 100644 --- a/crates/shirabe/src/plugin/plugin_manager.rs +++ b/crates/shirabe/src/plugin/plugin_manager.rs @@ -900,8 +900,7 @@ impl PluginManager { config.borrow_mut().get("allow-plugins").clone(); if let Some(arr) = allow_plugins_value.as_array() { let mut allow_plugins = arr.clone(); - allow_plugins - .insert(package.to_string(), Box::new(PhpMixed::Bool(allow))); + allow_plugins.insert(package.to_string(), PhpMixed::Bool(allow)); if config .borrow_mut() .get("sort-packages") @@ -917,20 +916,16 @@ impl PluginManager { "allow-plugins", PhpMixed::Array(allow_plugins.clone()), )?; - let mut inner: IndexMap> = IndexMap::new(); + let mut inner = IndexMap::new(); inner.insert( "allow-plugins".to_string(), - Box::new(PhpMixed::Array(allow_plugins)), + PhpMixed::Array(allow_plugins), ); - let mut config_section: IndexMap> = - IndexMap::new(); - config_section - .insert("config".to_string(), Box::new(PhpMixed::Array(inner))); - let wrap: IndexMap = - config_section.into_iter().map(|(k, v)| (k, *v)).collect(); + let mut config_section = IndexMap::new(); + config_section.insert("config".to_string(), PhpMixed::Array(inner)); config .borrow_mut() - .merge(&wrap, crate::config::Config::SOURCE_UNKNOWN); + .merge(&config_section, crate::config::Config::SOURCE_UNKNOWN); } } diff --git a/crates/shirabe/src/plugin/pre_file_download_event.rs b/crates/shirabe/src/plugin/pre_file_download_event.rs index 3bf6296..0cd14d7 100644 --- a/crates/shirabe/src/plugin/pre_file_download_event.rs +++ b/crates/shirabe/src/plugin/pre_file_download_event.rs @@ -15,7 +15,7 @@ pub struct PreFileDownloadEvent { custom_cache_key: Option, r#type: String, context: PhpMixed, - transport_options: IndexMap>, + transport_options: IndexMap, } impl PreFileDownloadEvent { @@ -69,11 +69,11 @@ impl PreFileDownloadEvent { &self.context } - pub fn get_transport_options(&self) -> &IndexMap> { + pub fn get_transport_options(&self) -> &IndexMap { &self.transport_options } - pub fn set_transport_options(&mut self, options: IndexMap>) { + pub fn set_transport_options(&mut self, options: IndexMap) { self.transport_options = options; } } -- cgit v1.3.1