clawhdf5-remote: clippy clean with every feature set
checked_div in the test server's throttle, a slice for the single range of fetch_first, and dead-code allowances for the redaction helpers in a build with neither http nor a cloud store. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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<Vec<u8>, 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<u64>]) -> Result<Vec<Vec<u8>>, RemoteError> {
|
||||
|
||||
Reference in New Issue
Block a user