mirror of
https://github.com/narrrl/proton-sdk-rs.git
synced 2026-11-03 16:41:26 +01:00
clippy + fmt
This commit is contained in:
1 parent
9ec205f217
commit
f702e56110
3 files changed
+8
-12
No files matched your search
@@ -542,12 +542,7 @@ impl ProtonDriveClient {
|
||||
/// Unlike [`download_file_to`](Self::download_file_to), a partial read
|
||||
/// cannot recompute the full content manifest, so manifest-signature
|
||||
/// verification is skipped.
|
||||
pub async fn download_range(
|
||||
&self,
|
||||
uid: &NodeUid,
|
||||
offset: u64,
|
||||
length: u64,
|
||||
) -> Result<Vec<u8>> {
|
||||
pub async fn download_range(&self, uid: &NodeUid, offset: u64, length: u64) -> Result<Vec<u8>> {
|
||||
let mut timer = self.telemetry.start("download_range");
|
||||
let details = self
|
||||
.get_link_details(&uid.volume_id, std::slice::from_ref(&uid.link_id))
|
||||
|
||||
@@ -180,7 +180,8 @@ async fn download_range_single_block() {
|
||||
let to = ((off + len) as usize).min(size);
|
||||
let want = &payload[from..to];
|
||||
assert_eq!(
|
||||
got, want,
|
||||
got,
|
||||
want,
|
||||
"range(off={off}, len={len}) mismatch: got {} bytes, want {}",
|
||||
got.len(),
|
||||
want.len()
|
||||
@@ -235,7 +236,7 @@ async fn download_range_multi_block() {
|
||||
(block - 128, 256), // straddles block 1 → block 2
|
||||
(block, 4096), // exact start of block 2
|
||||
(2 * block - 1, 2), // straddles block 2 → block 3 (final short block)
|
||||
(2 * block + 1000, 50_000),// interior of final short block
|
||||
(2 * block + 1000, 50_000), // interior of final short block
|
||||
(total - 100, 500), // tail, length past EOF → clamps
|
||||
(block - 10, block + 20), // spans a full block plus both neighbors
|
||||
(0, total), // whole file
|
||||
|
||||
@@ -277,14 +277,14 @@ impl ApiHttpClient {
|
||||
) -> Result<reqwest::Response> {
|
||||
// Don't bother refreshing for terminal account states.
|
||||
let bytes = response.bytes().await?;
|
||||
if let Ok(envelope) = serde_json::from_slice::<ApiResponse>(&bytes) {
|
||||
if matches!(
|
||||
if let Ok(envelope) = serde_json::from_slice::<ApiResponse>(&bytes)
|
||||
&& matches!(
|
||||
envelope.code,
|
||||
ResponseCode::AccountDeleted | ResponseCode::AccountDisabled
|
||||
) {
|
||||
)
|
||||
{
|
||||
return Err(api_error(StatusCode::UNAUTHORIZED, &bytes));
|
||||
}
|
||||
}
|
||||
|
||||
let access_token = self.refresh_access_token(&rejected_access_token).await?;
|
||||
self.send_with_token(method, path, body, &access_token)
|
||||
|
||||
Reference in new issue
Block a user