mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-19 17:46:17 +00:00
style: corrects the use of ';' to improve readability
- remove unnecessary semicolon and enable lint warning: unnecessary semicolon help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_semicolon - add `;` to the last statement for consitent formatting and enable lint `clippy::semicolon_if_nothing_returned` warning: consider adding a `;` to the last statement for consistent formatting help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#semicolon_if_nothing_returned
This commit is contained in:
@@ -557,7 +557,7 @@ impl RequestHandler for AddBucketAliasRequest {
|
||||
BucketAliasEnum::Global { global_alias } => {
|
||||
helper
|
||||
.set_global_bucket_alias(bucket_id, &global_alias)
|
||||
.await?
|
||||
.await?;
|
||||
}
|
||||
BucketAliasEnum::Local {
|
||||
local_alias,
|
||||
@@ -565,7 +565,7 @@ impl RequestHandler for AddBucketAliasRequest {
|
||||
} => {
|
||||
helper
|
||||
.set_local_bucket_alias(bucket_id, &access_key_id, &local_alias)
|
||||
.await?
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ impl RequestHandler for RemoveBucketAliasRequest {
|
||||
BucketAliasEnum::Global { global_alias } => {
|
||||
helper
|
||||
.unset_global_bucket_alias(bucket_id, &global_alias)
|
||||
.await?
|
||||
.await?;
|
||||
}
|
||||
BucketAliasEnum::Local {
|
||||
local_alias,
|
||||
@@ -599,7 +599,7 @@ impl RequestHandler for RemoveBucketAliasRequest {
|
||||
} => {
|
||||
helper
|
||||
.unset_local_bucket_alias(bucket_id, &access_key_id, &local_alias)
|
||||
.await?
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -869,7 +869,7 @@ impl Modify for SecurityAddon {
|
||||
components.add_security_scheme(
|
||||
"bearerAuth",
|
||||
SecurityScheme::Http(Http::builder().scheme(HttpAuthScheme::Bearer).build()),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ impl Endpoint {
|
||||
]);
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
debug!("Unused query parameter: {}", message)
|
||||
debug!("Unused query parameter: {}", message);
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
|
||||
@@ -126,7 +126,7 @@ impl Endpoint {
|
||||
]);
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
debug!("Unused query parameter: {}", message)
|
||||
debug!("Unused query parameter: {}", message);
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
|
||||
@@ -89,7 +89,7 @@ impl AdminApiRequest {
|
||||
]);
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
debug!("Unused query parameter: {}", message)
|
||||
debug!("Unused query parameter: {}", message);
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
|
||||
@@ -125,7 +125,7 @@ impl<A: ApiHandler> ApiServer<A> {
|
||||
}
|
||||
UnixOrTCPSocketAddress::UnixSocket(ref path) => {
|
||||
if path.exists() {
|
||||
fs::remove_file(path)?
|
||||
fs::remove_file(path)?;
|
||||
}
|
||||
|
||||
let listener = UnixListener::bind(path)?;
|
||||
@@ -190,7 +190,7 @@ impl<A: ApiHandler> ApiServer<A> {
|
||||
let mut http_error_builder = Response::builder().status(e.http_status_code());
|
||||
|
||||
if let Some(header_map) = http_error_builder.headers_mut() {
|
||||
e.add_http_headers(header_map)
|
||||
e.add_http_headers(header_map);
|
||||
}
|
||||
|
||||
let http_error = http_error_builder.body(body)?;
|
||||
|
||||
@@ -89,7 +89,7 @@ impl ReqBody {
|
||||
checksummer
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
}
|
||||
Err(frame) => {
|
||||
let trailers = frame.into_trailers().unwrap();
|
||||
|
||||
@@ -90,7 +90,7 @@ impl Endpoint {
|
||||
};
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
debug!("Unused query parameter: {}", message)
|
||||
debug!("Unused query parameter: {}", message);
|
||||
}
|
||||
Ok((res, bucket))
|
||||
}
|
||||
|
||||
@@ -660,11 +660,11 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_encrypt_block() {
|
||||
test_block_enc(None).await
|
||||
test_block_enc(None).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_encrypt_block_compressed() {
|
||||
test_block_enc(Some(1)).await
|
||||
test_block_enc(Some(1)).await;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -484,7 +484,7 @@ where
|
||||
iter.next();
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
|
||||
while let Some(object) = iter.peek() {
|
||||
if !object.key.starts_with(&query.prefix) {
|
||||
@@ -508,7 +508,7 @@ where
|
||||
ExtractionResult::NoMore => {
|
||||
return Ok(None);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if !server_more {
|
||||
@@ -756,7 +756,7 @@ impl<K: std::cmp::Ord, V> Accumulator<K, V> {
|
||||
None => Some(ExtractionResult::NoMore),
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,7 +1069,7 @@ mod tests {
|
||||
assert_eq!(upload, Uuid::from([0x8f; 32]));
|
||||
}
|
||||
_ => panic!("wrong result"),
|
||||
};
|
||||
}
|
||||
|
||||
assert_eq!(acc.keys.len(), 2);
|
||||
assert_eq!(
|
||||
@@ -1098,7 +1098,7 @@ mod tests {
|
||||
match acc.extract(&(query().common), &start, &mut iter) {
|
||||
ExtractionResult::Extracted { key } if key.as_str() == "b" => (),
|
||||
_ => panic!("wrong result"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -370,7 +370,7 @@ pub async fn handle_complete_multipart_upload(
|
||||
req_part.part_number, req_part.checksum, part.checksum
|
||||
)));
|
||||
}
|
||||
parts.push(*part)
|
||||
parts.push(*part);
|
||||
}
|
||||
_ => return Err(Error::InvalidPart),
|
||||
}
|
||||
|
||||
+4
-4
@@ -192,7 +192,7 @@ pub(crate) async fn save_stream<S: Stream<Item = Result<Bytes, Error>> + Unpin>(
|
||||
meta.checksum = checksums.extract(Some(algo));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let size = first_block.len() as u64;
|
||||
check_quotas(ctx, size, existing_object.as_ref()).await?;
|
||||
@@ -293,7 +293,7 @@ pub(crate) async fn save_stream<S: Stream<Item = Result<Bytes, Error>> + Unpin>(
|
||||
meta.checksum = checksums.extract(Some(algo));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Verify quotas are respsected
|
||||
check_quotas(ctx, total_size, existing_object.as_ref()).await?;
|
||||
@@ -339,7 +339,7 @@ pub(crate) async fn check_quotas(
|
||||
let quotas = bucket_params.quotas.get();
|
||||
if quotas.max_objects.is_none() && quotas.max_size.is_none() {
|
||||
return Ok(());
|
||||
};
|
||||
}
|
||||
|
||||
let counters = garage
|
||||
.object_counter_table
|
||||
@@ -436,7 +436,7 @@ pub(crate) async fn read_and_put_blocks<S: Stream<Item = Result<Bytes, Error>> +
|
||||
tracer.start("Hash block (md5, sha256)"),
|
||||
))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
}
|
||||
Err(e) => {
|
||||
block_tx2.send(Err(e)).await?;
|
||||
|
||||
@@ -365,7 +365,7 @@ impl Endpoint {
|
||||
}
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
debug!("Unused query parameter: {}", message)
|
||||
debug!("Unused query parameter: {}", message);
|
||||
}
|
||||
Ok((res, Some(bucket)))
|
||||
}
|
||||
@@ -580,7 +580,7 @@ impl Endpoint {
|
||||
pub fn authorization_type(&self) -> Authorization {
|
||||
if let Endpoint::ListBuckets = self {
|
||||
return Authorization::None;
|
||||
};
|
||||
}
|
||||
let readonly = router_match! {
|
||||
@match
|
||||
self,
|
||||
@@ -725,7 +725,7 @@ mod tests {
|
||||
) -> (Endpoint, Option<String>) {
|
||||
let mut req = Request::builder().method(method).uri(uri);
|
||||
if let Some((k, v)) = header {
|
||||
req = req.header(k, v)
|
||||
req = req.header(k, v);
|
||||
}
|
||||
let req = req.body(()).unwrap();
|
||||
|
||||
@@ -859,7 +859,7 @@ mod tests {
|
||||
.body(())
|
||||
.unwrap();
|
||||
|
||||
assert!(Endpoint::from_request(&req, None).is_err())
|
||||
assert!(Endpoint::from_request(&req, None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user