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
+7
-11
No files matched your search
@@ -542,12 +542,7 @@ impl ProtonDriveClient {
|
|||||||
/// Unlike [`download_file_to`](Self::download_file_to), a partial read
|
/// Unlike [`download_file_to`](Self::download_file_to), a partial read
|
||||||
/// cannot recompute the full content manifest, so manifest-signature
|
/// cannot recompute the full content manifest, so manifest-signature
|
||||||
/// verification is skipped.
|
/// verification is skipped.
|
||||||
pub async fn download_range(
|
pub async fn download_range(&self, uid: &NodeUid, offset: u64, length: u64) -> Result<Vec<u8>> {
|
||||||
&self,
|
|
||||||
uid: &NodeUid,
|
|
||||||
offset: u64,
|
|
||||||
length: u64,
|
|
||||||
) -> Result<Vec<u8>> {
|
|
||||||
let mut timer = self.telemetry.start("download_range");
|
let mut timer = self.telemetry.start("download_range");
|
||||||
let details = self
|
let details = self
|
||||||
.get_link_details(&uid.volume_id, std::slice::from_ref(&uid.link_id))
|
.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 to = ((off + len) as usize).min(size);
|
||||||
let want = &payload[from..to];
|
let want = &payload[from..to];
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
got, want,
|
got,
|
||||||
|
want,
|
||||||
"range(off={off}, len={len}) mismatch: got {} bytes, want {}",
|
"range(off={off}, len={len}) mismatch: got {} bytes, want {}",
|
||||||
got.len(),
|
got.len(),
|
||||||
want.len()
|
want.len()
|
||||||
|
|||||||
@@ -277,14 +277,14 @@ impl ApiHttpClient {
|
|||||||
) -> Result<reqwest::Response> {
|
) -> Result<reqwest::Response> {
|
||||||
// Don't bother refreshing for terminal account states.
|
// Don't bother refreshing for terminal account states.
|
||||||
let bytes = response.bytes().await?;
|
let bytes = response.bytes().await?;
|
||||||
if let Ok(envelope) = serde_json::from_slice::<ApiResponse>(&bytes) {
|
if let Ok(envelope) = serde_json::from_slice::<ApiResponse>(&bytes)
|
||||||
if matches!(
|
&& matches!(
|
||||||
envelope.code,
|
envelope.code,
|
||||||
ResponseCode::AccountDeleted | ResponseCode::AccountDisabled
|
ResponseCode::AccountDeleted | ResponseCode::AccountDisabled
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return Err(api_error(StatusCode::UNAUTHORIZED, &bytes));
|
return Err(api_error(StatusCode::UNAUTHORIZED, &bytes));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let access_token = self.refresh_access_token(&rejected_access_token).await?;
|
let access_token = self.refresh_access_token(&rejected_access_token).await?;
|
||||||
self.send_with_token(method, path, body, &access_token)
|
self.send_with_token(method, path, body, &access_token)
|
||||||
|
|||||||
Reference in new issue
Block a user