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-symfony-console/src/output/stream_output.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/shirabe-symfony-console/src/output') diff --git a/crates/shirabe-symfony-console/src/output/stream_output.rs b/crates/shirabe-symfony-console/src/output/stream_output.rs index 14565012..0d59fe2c 100644 --- a/crates/shirabe-symfony-console/src/output/stream_output.rs +++ b/crates/shirabe-symfony-console/src/output/stream_output.rs @@ -5,7 +5,7 @@ use crate::formatter::OutputFormatterInterface; use crate::output::OutputInterface; use crate::output::VERBOSITY_NORMAL; use crate::output::{DoWrite, Output}; -use shirabe_php_shim::{php_regex, preg_match}; +use shirabe_php_shim::{php_regex, preg_is_match}; /// StreamOutput writes the output to a given stream. /// @@ -120,13 +120,12 @@ impl StreamOutput { } // See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157 - preg_match( + preg_is_match( php_regex!( "/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/" ), &term, ) - .is_some() } } -- cgit v1.3.1-4-g156e