aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/svn_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
commitfed0a6e7ac361af9b963c1f62411b1a85478230c (patch)
tree5cde64a24845c761890fbcbe05e0d702f1ec8df7 /crates/shirabe/src/downloader/svn_downloader.rs
parente093b2be1c333e67c96aebb0a5291bea9ae3d6db (diff)
downloadphp-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.tar.gz
php-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.tar.zst
php-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader/svn_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 42152eb3..93b860f0 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -16,8 +16,8 @@ use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
use indexmap::IndexMap;
use shirabe_php_shim::{
- CmpOp, PhpMixed, RuntimeException, impl_php_class, is_dir, php_regex, preg_match, preg_replace,
- preg_split, version_compare,
+ CmpOp, PhpMixed, RuntimeException, impl_php_class, is_dir, php_regex, preg_is_match,
+ preg_match, preg_replace, preg_split, version_compare,
};
#[derive(Debug)]
@@ -353,8 +353,8 @@ impl VcsDownloader for SvnDownloader {
to_reference: &str,
path: &str,
) -> anyhow::Result<String> {
- if preg_match(php_regex!(r"{@(\d+)$}"), from_reference).is_some()
- && preg_match(php_regex!(r"{@(\d+)$}"), to_reference).is_some()
+ if preg_is_match(php_regex!(r"{@(\d+)$}"), from_reference)
+ && preg_is_match(php_regex!(r"{@(\d+)$}"), to_reference)
{
// retrieve the svn base url from the checkout folder
let command = vec![
@@ -452,13 +452,11 @@ impl ChangeReportInterface for SvnDownloader {
Some(path),
);
- Ok(
- if preg_match(php_regex!("{^ *[^X ] +}m"), &output).is_some() {
- Some(output)
- } else {
- None
- },
- )
+ Ok(if preg_is_match(php_regex!("{^ *[^X ] +}m"), &output) {
+ Some(output)
+ } else {
+ None
+ })
}
}