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/advisory/audit_config.rs | 8 ++++---- crates/shirabe/src/advisory/auditor.rs | 12 +++--------- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'crates/shirabe/src/advisory') diff --git a/crates/shirabe/src/advisory/audit_config.rs b/crates/shirabe/src/advisory/audit_config.rs index bcd0763..28e5e68 100644 --- a/crates/shirabe/src/advisory/audit_config.rs +++ b/crates/shirabe/src/advisory/audit_config.rs @@ -82,7 +82,7 @@ impl AuditConfig { }; for (key, value) in entries { - let (id, apply, reason) = match value.as_ref() { + let (id, apply, reason) = match value { PhpMixed::String(reason_str) => { (key.clone(), "all".to_string(), Some(reason_str.clone())) } @@ -136,21 +136,21 @@ impl AuditConfig { let ignore_raw = audit_config .and_then(|m| m.get("ignore")) - .map(|v| *v.clone()) + .cloned() .unwrap_or_else(|| empty_array.clone()); let (ignore_list_for_audit, ignore_list_for_blocking) = Self::parse_ignore_with_apply(&ignore_raw)?; let ignore_abandoned_raw = audit_config .and_then(|m| m.get("ignore-abandoned")) - .map(|v| *v.clone()) + .cloned() .unwrap_or_else(|| empty_array.clone()); let (ignore_abandoned_for_audit, ignore_abandoned_for_blocking) = Self::parse_ignore_with_apply(&ignore_abandoned_raw)?; let ignore_severity_raw = audit_config .and_then(|m| m.get("ignore-severity")) - .map(|v| *v.clone()) + .cloned() .unwrap_or_else(|| empty_array.clone()); let (ignore_severity_for_audit, ignore_severity_for_blocking) = Self::parse_ignore_with_apply(&ignore_severity_raw)?; diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs index 5a41b30..411e83e 100644 --- a/crates/shirabe/src/advisory/auditor.rs +++ b/crates/shirabe/src/advisory/auditor.rs @@ -468,11 +468,7 @@ impl Auditor { .set_horizontal(true) .set_headers(headers.into_iter().map(|h| h.into()).collect()); table.add_row(ConsoleIO::sanitize( - PhpMixed::List( - row.into_iter() - .map(|s| Box::new(PhpMixed::String(s))) - .collect(), - ), + PhpMixed::List(row.into_iter().map(PhpMixed::String).collect()), false, ))??; table @@ -595,10 +591,8 @@ impl Auditor { }; table.add_row(ConsoleIO::sanitize( PhpMixed::List(vec![ - Box::new(PhpMixed::String( - self.get_package_name_with_link(pkg.clone().into()), - )), - Box::new(PhpMixed::String(replacement)), + PhpMixed::String(self.get_package_name_with_link(pkg.clone().into())), + PhpMixed::String(replacement), ]), false, )); -- cgit v1.3.1