From cb77f7c7076aa4bac3e6aaa1c164cf9c1d449ddc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: refactor(preg): fold preg_match into preg_match2 preg_match copied every group into a Vec> while preg_match2 handed back the borrowed captures. They now differ only in the offset argument, so preg_match delegates with offset 0 and its callers read groups through PregMatches::get. Going through preg_match2 also makes preg_match honour the PCRE A modifier, which it used to ignore; no caller passes such a pattern. VersionParser::manipulate_version_string takes an index accessor instead of a slice, and VersionParser::normalize matches against a copy of the subject because the captures outlive the assignments to $version. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-symfony-console/src/input/argv_input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/shirabe-symfony-console/src/input') diff --git a/crates/shirabe-symfony-console/src/input/argv_input.rs b/crates/shirabe-symfony-console/src/input/argv_input.rs index 81582408..94e5299d 100644 --- a/crates/shirabe-symfony-console/src/input/argv_input.rs +++ b/crates/shirabe-symfony-console/src/input/argv_input.rs @@ -526,8 +526,8 @@ impl std::fmt::Display for ArgvInput { if let Some(r#match) = preg_match(php_regex!("{^(-[^=]+=)(.+)}"), token) { return format!( "{}{}", - r#match[1].as_deref().unwrap_or(""), - self.inner.escape_token(r#match[2].as_deref().unwrap_or("")) + r#match.get(1).unwrap_or(""), + self.inner.escape_token(r#match.get(2).unwrap_or("")) ); } -- cgit v1.3.1-4-g156e