summaryrefslogtreecommitdiffstats
path: root/src/urlutil.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/urlutil.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
Diffstat (limited to 'src/urlutil.rs')
-rw-r--r--src/urlutil.rs11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/urlutil.rs b/src/urlutil.rs
index 51def16..0452ccd 100644
--- a/src/urlutil.rs
+++ b/src/urlutil.rs
@@ -1,25 +1,14 @@
use std::collections::BTreeSet;
-/// The host of one `source=()` entry, or `None` when it names no host — a local
-/// file, a relative path, or a `file://` URL.
-///
-/// Handles the `custom::` and `git+`/`svn+`/`npm+` prefixes a PKGBUILD puts before a
-/// URL.
pub fn host_of(source: &str) -> Option<String> {
let s = source.rsplit("::").next().unwrap_or(source);
let s = s.rsplit('+').next().unwrap_or(s);
let rest = s.split("://").nth(1)?;
let host = rest.split('/').next()?;
- // `git+ssh://git@github.com/...` names the same place as
- // `https://github.com/...`; leaving the user in would make a scheme change
- // look like a new source host and cry wolf at a reviewer.
let host = host.rsplit('@').next().unwrap_or(host);
(!host.is_empty()).then(|| host.to_string())
}
-/// The distinct hosts a `source=()` array names, sorted. A host appearing here
-/// that was not in the accepted release's list is a new place the build fetches
-/// code from (§5.3, §6).
pub fn hosts(sources: &[String]) -> BTreeSet<String> {
sources.iter().map(|s| s.as_str()).filter_map(host_of).collect()
}