From a1c7e6908a26e10f6e1f23a51721664b5e2d838d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 02:53:53 +0900 Subject: chore(style): cargo fmt --- crates/shirabe/src/util/composer_mirror.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/util/composer_mirror.rs') diff --git a/crates/shirabe/src/util/composer_mirror.rs b/crates/shirabe/src/util/composer_mirror.rs index 1ec3e56..0743e9f 100644 --- a/crates/shirabe/src/util/composer_mirror.rs +++ b/crates/shirabe/src/util/composer_mirror.rs @@ -39,7 +39,10 @@ impl ComposerMirror { to.push(pv); } - let url = from.iter().zip(to.iter()).fold(mirror_url.to_string(), |acc, (f, t)| acc.replace(f, t)); + let url = from + .iter() + .zip(to.iter()) + .fold(mirror_url.to_string(), |acc, (f, t)| acc.replace(f, t)); assert!(!url.is_empty()); url } @@ -50,9 +53,14 @@ impl ComposerMirror { url: &str, r#type: Option<&str>, ) -> String { - let normalized_url = if let Some(m) = Preg::match_(r"^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$", url) { + let normalized_url = if let Some(m) = Preg::match_( + r"^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$", + url, + ) { format!("gh-{}/{}", m[1], m[2]) - } else if let Some(m) = Preg::match_(r"^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$", url) { + } else if let Some(m) = + Preg::match_(r"^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$", url) + { format!("bb-{}/{}", m[1], m[2]) } else { Preg::replace(r"[^a-z0-9_.-]", "-", url.trim_matches('/')) @@ -64,12 +72,7 @@ impl ComposerMirror { .fold(mirror_url.to_string(), |acc, (f, t)| acc.replace(f, t)) } - pub fn process_hg_url( - mirror_url: &str, - package_name: &str, - url: &str, - r#type: &str, - ) -> String { + pub fn process_hg_url(mirror_url: &str, package_name: &str, url: &str, r#type: &str) -> String { Self::process_git_url(mirror_url, package_name, url, Some(r#type)) } } -- cgit v1.3.1