From dc0cc70f6916810f326d6019a4bec90ca2915904 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 17 Aug 2026 03:58:46 +0900 Subject: refactor(preg): drop Option wrapper from matches arg of match_all*() Every caller of Preg::match_all3()/is_match_all3() passed Some(&mut _), so the argument is now a plain &mut. Preg::match_all() keeps the no-captures form with a local throwaway map, and the arity suffixes are renumbered accordingly (match_all2(), is_match_all()). Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/command/init_command.rs | 2 +- crates/shirabe/src/downloader/git_downloader.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index 1ca3e428..af3d16e2 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -176,7 +176,7 @@ impl InitCommand { { *self.git_config.borrow_mut() = Some(IndexMap::new()); let mut m: IndexMap>> = IndexMap::new(); - if Preg::is_match_all3(php_regex!(r"{^([^=]+)=(.*)$}m"), &output, Some(&mut m)) { + if Preg::is_match_all(php_regex!(r"{^([^=]+)=(.*)$}m"), &output, &mut m) { let keys: Vec> = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); let values: Vec> = diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index b34f7800..7aeea252 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -110,10 +110,10 @@ impl GitDownloader { .unwrap_or_default(); let mut branches_match: IndexMap>> = IndexMap::new(); - if !Preg::is_match_all3( + if !Preg::is_match_all( format!("{{^{} refs/heads/(.+)$}}mi", preg_quote(&head_ref, None)), &refs, - Some(&mut branches_match), + &mut branches_match, ) { // not on a branch, we are either on a not-modified tag or some sort of detached head, so skip this return Ok(None); @@ -138,13 +138,13 @@ impl GitDownloader { // try to find matching branch names in remote repos for candidate in &candidate_branches { let mut m: IndexMap>> = IndexMap::new(); - if Preg::is_match_all3( + if Preg::is_match_all( format!( "{{^[a-f0-9]+ refs/remotes/((?:[^/]+)/{})$}}mi", preg_quote(candidate, None) ), &refs, - Some(&mut m), + &mut m, ) { let matches: Vec> = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); -- cgit v1.3.1-4-g156e