From e093b2be1c333e67c96aebb0a5291bea9ae3d6db Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: refactor(preg): drop the offset argument from preg_match Every call site but one passed offset 0. The remaining one, the UTF-8 chunking loop in Application, slices the subject instead: its pattern has no anchor or lookaround, so matching a suffix is equivalent to starting the search at that offset. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/dependency_resolver/lock_transaction.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/dependency_resolver/lock_transaction.rs') diff --git a/crates/shirabe/src/dependency_resolver/lock_transaction.rs b/crates/shirabe/src/dependency_resolver/lock_transaction.rs index df9a737d..71609658 100644 --- a/crates/shirabe/src/dependency_resolver/lock_transaction.rs +++ b/crates/shirabe/src/dependency_resolver/lock_transaction.rs @@ -5,7 +5,7 @@ use crate::dependency_resolver::Pool; use crate::dependency_resolver::Transaction; use crate::package::PackageInterfaceHandle; use indexmap::IndexMap; -use shirabe_php_shim::{PregMatches, php_regex, preg_match2, preg_replace_callback}; +use shirabe_php_shim::{PregMatches, php_regex, preg_match, preg_replace_callback}; #[derive(Debug)] pub struct LockTransaction { @@ -158,9 +158,9 @@ impl LockTransaction { if package.get_dist_url().is_some() && present_package.get_dist_reference().is_some() - && preg_match2(php_regex!( + && preg_match(php_regex!( r"{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i" - ), &package.get_dist_url().unwrap(), 0).is_some() + ), &package.get_dist_url().unwrap()).is_some() { // Regex pattern compatibility: // The `regex` crate has no look-around, so `(?<=/|sha=)[a-f0-9]{40}(?=/|$)` is -- cgit v1.3.1-4-g156e