From 70e463708b461efd61a611061cfee0539d28645a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 06:36:42 +0900 Subject: refactor: replace literal-list in_array_strict with matches! Call sites whose haystack was an inline array of literals (or a local built solely to feed one) had to wrap both sides in PhpMixed just to compare, allocating a String per element on every call. matches! does the same test against the underlying &str/i64/Option directly, so the PhpMixed round trip and its .to_string()/.clone()/.iter().map() conversions are gone. Sites whose haystack is a runtime value or a named constant array are left on in_array_strict: inlining a named constant would duplicate its contents at the call site. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs') diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index 6b62d818..8fe93018 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -18,8 +18,8 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists, - array_search_mixed, extension_loaded, http_build_query_mixed, implode, in_array_strict, - is_array, php_regex, strpos, + array_search_mixed, extension_loaded, http_build_query_mixed, implode, is_array, php_regex, + strpos, }; #[derive(Debug)] @@ -697,7 +697,7 @@ impl GitBitbucketDriver { { let te = &e; let code = te.get_code(); - let in_set = in_array_strict(code, &[PhpMixed::Int(403), PhpMixed::Int(404)]); + let in_set = matches!(code, 403 | 404); if in_set || (401 == code && strpos(te.get_message(), "Could not authenticate against") -- cgit v1.3.1