diff options
author | Alex <alex@adnab.me> | 2023-05-11 09:33:03 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-05-11 09:33:03 +0000 |
commit | 375270afd19a8ce2aa3ff99bd0fc3ccab638c223 (patch) | |
tree | 362189dcfde317ef4dd0613ab621684469c17168 /src/api | |
parent | b925f53dc3b0bae77aa3f73e581faace2eb3b21a (diff) | |
parent | c783194e8b8c3263fad579a85ea07d62e63b16be (diff) | |
download | garage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.tar.gz garage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.zip |
Merge pull request '*: apply clippy recommendations.' (#570) from jpds/garage:clippy-fixes into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/570
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/admin/api_server.rs | 2 | ||||
-rw-r--r-- | src/api/admin/bucket.rs | 4 | ||||
-rw-r--r-- | src/api/admin/key.rs | 4 | ||||
-rw-r--r-- | src/api/generic_server.rs | 2 | ||||
-rw-r--r-- | src/api/k2v/batch.rs | 4 | ||||
-rw-r--r-- | src/api/s3/get.rs | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs index 58dd38d8..b0dfdfb7 100644 --- a/src/api/admin/api_server.rs +++ b/src/api/admin/api_server.rs @@ -105,7 +105,7 @@ impl AdminApiServer { let bucket_id = self .garage .bucket_helper() - .resolve_global_bucket_name(&domain) + .resolve_global_bucket_name(domain) .await? .ok_or(HelperError::NoSuchBucket(domain.to_string()))?; diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index e60f07ca..f0a4a9e7 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -183,8 +183,8 @@ async fn bucket_info_results( } }), keys: relevant_keys - .into_iter() - .map(|(_, key)| { + .into_values() + .map(|key| { let p = key.state.as_option().unwrap(); GetBucketInfoKey { access_key_id: key.key_id, diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index 2bbabb7b..d74ca361 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -183,8 +183,8 @@ async fn key_info_results(garage: &Arc<Garage>, key: Key) -> Result<Response<Bod create_bucket: *key_state.allow_create_bucket.get(), }, buckets: relevant_buckets - .into_iter() - .map(|(_, bucket)| { + .into_values() + .map(|bucket| { let state = bucket.state.as_option().unwrap(); KeyInfoBucketResult { id: hex::encode(bucket.id), diff --git a/src/api/generic_server.rs b/src/api/generic_server.rs index d0354d28..757b85ec 100644 --- a/src/api/generic_server.rs +++ b/src/api/generic_server.rs @@ -128,7 +128,7 @@ impl<A: ApiHandler> ApiServer<A> { let uri = req.uri().clone(); if let Ok(forwarded_for_ip_addr) = - forwarded_headers::handle_forwarded_for_headers(&req.headers()) + forwarded_headers::handle_forwarded_for_headers(req.headers()) { info!( "{} (via {}) {} {}", diff --git a/src/api/k2v/batch.rs b/src/api/k2v/batch.rs index 26d678da..294380ea 100644 --- a/src/api/k2v/batch.rs +++ b/src/api/k2v/batch.rs @@ -282,8 +282,8 @@ pub(crate) async fn handle_poll_range( if let Some((items, seen_marker)) = resp { let resp = PollRangeResponse { items: items - .into_iter() - .map(|(_k, i)| ReadBatchResponseItem::from(i)) + .into_values() + .map(ReadBatchResponseItem::from) .collect::<Vec<_>>(), seen_marker, }; diff --git a/src/api/s3/get.rs b/src/api/s3/get.rs index 2a99551a..cde7b461 100644 --- a/src/api/s3/get.rs +++ b/src/api/s3/get.rs @@ -443,7 +443,7 @@ fn body_from_blocks_range( // block.part_number, which is not the same in the case of a multipart upload) let mut blocks: Vec<(VersionBlock, u64)> = Vec::with_capacity(std::cmp::min( all_blocks.len(), - 4 + ((end - begin) / std::cmp::max(all_blocks[0].1.size as u64, 1024)) as usize, + 4 + ((end - begin) / std::cmp::max(all_blocks[0].1.size, 1024)) as usize, )); let mut block_offset: u64 = 0; for (_, b) in all_blocks.iter() { @@ -454,7 +454,7 @@ fn body_from_blocks_range( if block_offset < end && block_offset + b.size > begin { blocks.push((*b, block_offset)); } - block_offset += b.size as u64; + block_offset += b.size; } let order_stream = OrderTag::stream(); |