diff options
Diffstat (limited to 'crates/shirabe/src/repository/vcs/github_driver.rs')
| -rw-r--r-- | crates/shirabe/src/repository/vcs/github_driver.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index 4c0df86a..10a61feb 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -14,7 +14,7 @@ use crate::util::GitHub; use crate::util::http::Response; use chrono::{DateTime, FixedOffset}; use indexmap::IndexMap; -use shirabe_pcre::{CaptureKey, Preg}; +use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_map, @@ -70,7 +70,7 @@ impl GitHubDriver { } pub fn initialize(&mut self) -> anyhow::Result<()> { - let mut match_: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut match_ = PregMatchedGroups::new(); if !Preg::is_match3( php_regex!( r"#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#" @@ -495,7 +495,7 @@ impl GitHubDriver { let mut key: Option<String> = None; for line in preg_split(php_regex!(r"{\r?\n}"), &funding) { let line = trim(&line, None); - let mut m: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut m = PregMatchedGroups::new(); if Preg::is_match3(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line, Some(&mut m)) { let g1 = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); let g2 = m.get(&CaptureKey::ByIndex(2)).cloned().unwrap_or_default(); @@ -503,7 +503,7 @@ impl GitHubDriver { key = Some(g1); continue; } - let mut m2: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut m2 = PregMatchedGroups::new(); if Preg::is_match3(php_regex!(r"{^\[(.*?)\](?:\s*#.*)?$}"), &g2, Some(&mut m2)) { let inner = m2.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); for item in array_map( @@ -538,7 +538,7 @@ impl GitHubDriver { } else if Preg::is_match3(php_regex!(r"{^(\w+)\s*:\s*#\s*$}"), &line, Some(&mut m)) { key = Some(m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default()); } else if key.is_some() && { - let mut tmp: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut tmp = PregMatchedGroups::new(); Preg::is_match3(php_regex!(r"{^-\s*(.+)(?:\s+#.*)?$}"), &line, Some(&mut m)) || Preg::is_match3(php_regex!(r"{^(.+),(?:\s*#.*)?$}"), &line, Some(&mut tmp)) && { @@ -936,7 +936,7 @@ impl GitHubDriver { url: &str, _deep: bool, ) -> anyhow::Result<bool> { - let mut matches: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut matches = PregMatchedGroups::new(); if !Preg::is_match3( php_regex!( r"#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#" @@ -1284,7 +1284,7 @@ impl GitHubDriver { let links = explode(",", &header); for link in &links { - let mut m: IndexMap<CaptureKey, String> = IndexMap::new(); + let mut m = PregMatchedGroups::new(); if Preg::is_match3(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link, Some(&mut m)) { return Some(m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default()); } |
