summaryrefslogtreecommitdiffstats
path: root/src/fetch.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/fetch.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/fetch.rs')
-rw-r--r--src/fetch.rs4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/fetch.rs b/src/fetch.rs
index c802339..1d06051 100644
--- a/src/fetch.rs
+++ b/src/fetch.rs
@@ -17,8 +17,6 @@ impl Read for Body {
}
}
-/// Open a URL for streaming. Never buffers the whole body: sources are hashed
-/// while they are written into the cache (§5.3).
pub fn open(url: &str) -> Result<(Body, Option<u64>)> {
if let Some(path) = url.strip_prefix("file://") {
let p = path.trim_start_matches('/');
@@ -40,7 +38,6 @@ pub fn open(url: &str) -> Result<(Body, Option<u64>)> {
Err(Error::invalid(format!("unsupported url scheme: {url}")))
}
-/// Fetch `url` into `dest`, returning `(sha256, size)`.
pub fn fetch_to(url: &str, dest: &std::path::Path) -> Result<(String, u64)> {
if let Some(parent) = dest.parent() {
std::fs::create_dir_all(parent)?;
@@ -53,7 +50,6 @@ pub fn fetch_to(url: &str, dest: &std::path::Path) -> Result<(String, u64)> {
let (digest, size) = crate::hash::digest_reader(std::io::BufReader::new(body), Some(&mut file))
.map_err(|e| Error::Http(format!("{url}: {e}")))?;
file.flush()?;
- // Rename into place: a half-written cache entry must never be visible.
std::fs::rename(&tmp, dest)?;
Ok((digest, size))
}