From d7c686f6c488739fc9d061bb0f89d73e6445fade Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 14 Jun 2026 13:08:21 +0900 Subject: refactor(pcre): return bool from preg_match shim preg_match can only return 1 or 0 now that compile failure panics, so return bool and update all call sites accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/symfony/console/terminal.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/terminal.rs') diff --git a/crates/shirabe-external-packages/src/symfony/console/terminal.rs b/crates/shirabe-external-packages/src/symfony/console/terminal.rs index 1f0fb65..5733b0c 100644 --- a/crates/shirabe-external-packages/src/symfony/console/terminal.rs +++ b/crates/shirabe-external-packages/src/symfony/console/terminal.rs @@ -87,8 +87,7 @@ impl Terminal { "/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/", &shirabe_php_shim::trim(ansicon, None), &mut matches, - ) != 0 - { + ) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" WIDTH.with(|w| { @@ -145,8 +144,7 @@ impl Terminal { "/rows.(\\d+);.columns.(\\d+);/i", &stty_string, &mut matches, - ) != 0 - { + ) { // extract [w, h] from "rows h; columns w;" WIDTH.with(|w| { w.set(Some(shirabe_php_shim::intval(&PhpMixed::String( @@ -162,8 +160,7 @@ impl Terminal { "/;.(\\d+).rows;.(\\d+).columns/i", &stty_string, &mut matches, - ) != 0 - { + ) { // extract [w, h] from "; h rows; w columns" WIDTH.with(|w| { w.set(Some(shirabe_php_shim::intval(&PhpMixed::String( @@ -187,12 +184,11 @@ impl Terminal { let info = info?; let mut matches: Vec> = Vec::new(); - if shirabe_php_shim::preg_match( + if !shirabe_php_shim::preg_match( "/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/", &info, &mut matches, - ) == 0 - { + ) { return None; } -- cgit v1.3.1