From a01330572b985007acae339817d171a6505bb16b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: refactor(preg): drop the Vec-returning preg_match_all The two preg_match_all variants took the same arguments and differed only in what they returned: a Vec of columns, or the named-and-numbered PregMatchesAll. The latter is the one all but two call sites already used, so preg_match_all2 takes over the plain PHP name and the Vec variant goes away. Its remaining readers only ever wanted group 0's column, which they now take through CaptureKey::ByIndex(0); in the formatter this replaces the array_shift that popped that column off the PREG_PATTERN_ORDER array. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/downloader/git_downloader.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/downloader') diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index d3dea453..6e79576d 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -19,7 +19,7 @@ use crate::util::Url; use indexmap::IndexMap; use shirabe_php_shim::{ CaptureKey, CmpOp, PhpMixed, RuntimeException, array_map, basename, dirname, impl_php_class, - implode, in_array_strict, is_dir, php_regex, preg_match_all2, preg_match2, preg_quote, + implode, in_array_strict, is_dir, php_regex, preg_match_all, preg_match2, preg_quote, preg_replace, preg_split, realpath, rtrim, strlen, strpos, substr, trim, version_compare, }; @@ -100,7 +100,7 @@ impl GitDownloader { }; let head_ref = head_match.get(1).unwrap_or_default().to_string(); - let branches_match = preg_match_all2( + let branches_match = preg_match_all( format!("{{^{} refs/heads/(.+)$}}mi", preg_quote(&head_ref, None)), &refs, ); @@ -127,7 +127,7 @@ impl GitDownloader { // try to find matching branch names in remote repos for candidate in &candidate_branches { - let m = preg_match_all2( + let m = preg_match_all( format!( "{{^[a-f0-9]+ refs/remotes/((?:[^/]+)/{})$}}mi", preg_quote(candidate, None) -- cgit v1.3.1-4-g156e