diff --git a/crates/clawhdf5-remote/src/error.rs b/crates/clawhdf5-remote/src/error.rs index 6e3c551..2e56bef 100644 --- a/crates/clawhdf5-remote/src/error.rs +++ b/crates/clawhdf5-remote/src/error.rs @@ -66,12 +66,20 @@ pub fn redact_url(url: &str) -> String { /// Replaces the secret parts of one URL (its userinfo and query string, /// and the URL itself) wherever they appear in a message — such as the /// text of an error from the HTTP client. +#[cfg_attr( + not(any(feature = "http", feature = "s3", feature = "gcs", feature = "azure")), + allow(dead_code) +)] #[derive(Debug, Clone)] pub(crate) struct Redactor { shown: String, secrets: Vec<(String, String)>, } +#[cfg_attr( + not(any(feature = "http", feature = "s3", feature = "gcs", feature = "azure")), + allow(dead_code) +)] impl Redactor { pub(crate) fn new(url: &str) -> Redactor { let shown = redact_url(url); @@ -177,7 +185,10 @@ pub enum RemoteError { impl RemoteError { /// The error with every secret part of `r`'s URL scrubbed from its text. - #[cfg_attr(not(any(feature = "http", feature = "object-store")), allow(dead_code))] + #[cfg_attr( + not(any(feature = "http", feature = "s3", feature = "gcs", feature = "azure")), + allow(dead_code) + )] pub(crate) fn scrubbed(self, r: &Redactor) -> RemoteError { let f = |s: String| r.scrub(&s); match self { diff --git a/crates/clawhdf5-remote/src/object.rs b/crates/clawhdf5-remote/src/object.rs index c0b7748..3ac9955 100644 --- a/crates/clawhdf5-remote/src/object.rs +++ b/crates/clawhdf5-remote/src/object.rs @@ -140,7 +140,10 @@ impl ObjectStoreStorage { /// The object's first `n` bytes (fewer if it is shorter). pub(crate) fn fetch_first(&self, n: u64) -> Result, RemoteError> { - Ok(self.fetch_all(&[0..n])?.pop().unwrap_or_default()) + Ok(self + .fetch_all(std::slice::from_ref(&(0..n)))? + .pop() + .unwrap_or_default()) } fn fetch_all(&self, ranges: &[Range]) -> Result>, RemoteError> { diff --git a/crates/clawhdf5-remote/tests/common/server.rs b/crates/clawhdf5-remote/tests/common/server.rs index ec7c8ae..cc27e6f 100644 --- a/crates/clawhdf5-remote/tests/common/server.rs +++ b/crates/clawhdf5-remote/tests/common/server.rs @@ -405,8 +405,8 @@ fn serve(conn: TcpStream, s: &Shared) -> std::io::Result<()> { for piece in rest.chunks(4096) { out.write_all(piece)?; out.flush()?; - if bps > 0 { - std::thread::sleep(Duration::from_micros(4096 * 1_000_000 / bps)); + if let Some(us) = (4096 * 1_000_000u64).checked_div(bps) { + std::thread::sleep(Duration::from_micros(us)); } } } else {