From fed0a6e7ac361af9b963c1f62411b1a85478230c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: refactor(preg): add preg_is_match for existence-only call sites The capture groups were discarded at 162 of the preg_match call sites, which only tested the Option. They now call preg_is_match, which lets the regex engine skip capture tracking. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/repository/vcs/github_driver.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/repository/vcs/github_driver.rs') diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index f310da3d..c41cc2d0 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -18,8 +18,8 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_map, array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array_loose, - parse_url, php_regex, preg_match, preg_replace, preg_split, strpos, strtolower, substr, trim, - urlencode, + parse_url, php_regex, preg_is_match, preg_match, preg_replace, preg_split, strpos, strtolower, + substr, trim, urlencode, }; #[derive(Debug)] @@ -642,9 +642,7 @@ impl GitHubDriver { }; if bits.scheme.is_none() && bits.host.is_none() { - if preg_match(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url) - .is_some() - { + if preg_is_match(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url) { result[key_idx].insert( "url".to_string(), PhpMixed::String(format!("https://{}", item_url)), -- cgit v1.3.1-4-g156e