From cfd2a4488797ddaabd0087aa0021b26892663ffb Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 14 Jun 2026 13:02:59 +0900 Subject: refactor(pcre): treat regex compile failure as fatal in shim The preg_* shim helpers wrapped their results in Option/Result solely to signal a regex that failed to compile. Composer never feeds a pattern that fails at runtime, so such a failure is a programming error: panic instead and drop the Option/Result wrappers, updating all callers. preg_replace_callback keeps its Result return type since the callback itself is fallible. preg_match_groups is removed in favor of preg_match at its sole call site. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../shirabe-external-packages/src/symfony/console/helper/helper.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/helper') diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs index 40a8f85..07b1f77 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs @@ -147,12 +147,10 @@ impl Helper { // remove <...> formatting let string = formatter.format(Some(string)).unwrap().unwrap_or_default(); // remove already formatted characters - let string = - shirabe_php_shim::preg_replace("/\u{1b}\\[[^m]*m/", "", &string).unwrap_or_default(); + let string = shirabe_php_shim::preg_replace("/\u{1b}\\[[^m]*m/", "", &string); // remove terminal hyperlinks let string = - shirabe_php_shim::preg_replace("/\u{1b}]8;[^;]*;[^\u{1b}]*\u{1b}\\\\/", "", &string) - .unwrap_or_default(); + shirabe_php_shim::preg_replace("/\u{1b}]8;[^;]*;[^\u{1b}]*\u{1b}\\\\/", "", &string); formatter.set_decorated(is_decorated); string -- cgit v1.3.1