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/remote_filesystem.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/remote_filesystem.rs')
| -rw-r--r-- | crates/shirabe/src/util/remote_filesystem.rs | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index 1890a95..c4b3923 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -234,7 +234,7 @@ impl RemoteFilesystem { if let Some(http_opts) = options.get_mut("http") && let PhpMixed::Array(m) = http_opts { - m.insert("ignore_errors".to_string(), Box::new(PhpMixed::Bool(true))); + m.insert("ignore_errors".to_string(), PhpMixed::Bool(true)); } let mut degraded_packagist = false; @@ -331,7 +331,7 @@ impl RemoteFilesystem { .map(|s| json_decode(s, true).unwrap_or(PhpMixed::Null)) .unwrap_or(PhpMixed::Null); let parsed_map: IndexMap<String, PhpMixed> = match parsed { - PhpMixed::Array(m) => m.into_iter().map(|(k, v)| (k, *v)).collect(), + PhpMixed::Array(m) => m.into_iter().collect(), _ => IndexMap::new(), }; let _ = HttpDownloader::output_warnings( @@ -854,10 +854,7 @@ impl RemoteFilesystem { .entry("http".to_string()) .or_insert_with(|| PhpMixed::Array(IndexMap::new())); if let PhpMixed::Array(m) = http_entry { - m.insert( - "protocol_version".to_string(), - Box::new(PhpMixed::Float(1.1)), - ); + m.insert("protocol_version".to_string(), PhpMixed::Float(1.1)); } headers.push("Connection: close".to_string()); } @@ -866,7 +863,7 @@ impl RemoteFilesystem { .get("http") .and_then(|v| v.as_array()) .and_then(|m| m.get("header")) - .map(|v| matches!(v.as_ref(), PhpMixed::String(_))) + .map(|v| matches!(v, PhpMixed::String(_))) .unwrap_or(false); if header_is_string { let header_str = options["http"].as_array().unwrap()["header"] @@ -877,12 +874,7 @@ impl RemoteFilesystem { if let Some(PhpMixed::Array(m)) = options.get_mut("http") { m.insert( "header".to_string(), - Box::new(PhpMixed::List( - split - .into_iter() - .map(|s| Box::new(PhpMixed::String(s))) - .collect(), - )), + PhpMixed::List(split.into_iter().map(PhpMixed::String).collect()), ); } } @@ -896,16 +888,16 @@ impl RemoteFilesystem { .entry("http".to_string()) .or_insert_with(|| PhpMixed::Array(IndexMap::new())); if let PhpMixed::Array(m) = http_entry { - m.insert("follow_location".to_string(), Box::new(PhpMixed::Int(0))); + m.insert("follow_location".to_string(), PhpMixed::Int(0)); } for header in headers { if let Some(PhpMixed::Array(m)) = options.get_mut("http") { let header_list = m .entry("header".to_string()) - .or_insert_with(|| Box::new(PhpMixed::List(Vec::new()))); - if let PhpMixed::List(l) = header_list.as_mut() { - l.push(Box::new(PhpMixed::String(header))); + .or_insert_with(|| PhpMixed::List(Vec::new())); + if let PhpMixed::List(l) = header_list { + l.push(PhpMixed::String(header)); } } } |
