From ada7899b24cacb4f95ee67ae92ddb73c04ee4d66 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 26 Oct 2021 10:20:05 +0200 Subject: Fix clippy lints (fix #121) --- src/api/api_server.rs | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'src/api/api_server.rs') diff --git a/src/api/api_server.rs b/src/api/api_server.rs index 52031ae0..d51b5a28 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -39,7 +39,7 @@ pub async fn run_api_server( } }); - let server = Server::bind(&addr).serve(service); + let server = Server::bind(addr).serve(service); let graceful = server.with_graceful_shutdown(shutdown_signal); info!("API server listening on http://{}", addr); @@ -88,8 +88,8 @@ async fn handler_inner(garage: Arc, req: Request) -> Result api_key.allow_read(&bucket), - _ => api_key.allow_write(&bucket), + &Method::HEAD | &Method::GET => api_key.allow_read(bucket), + _ => api_key.allow_write(bucket), }; if !allowed { return Err(Error::Forbidden( @@ -109,11 +109,11 @@ async fn handler_inner(garage: Arc, req: Request) -> Result { // HeadObject query - Ok(handle_head(garage, &req, &bucket, &key).await?) + Ok(handle_head(garage, &req, bucket, key).await?) } Method::GET => { // GetObject query - Ok(handle_get(garage, &req, &bucket, &key).await?) + Ok(handle_get(garage, &req, bucket, key).await?) } Method::PUT => { if params.contains_key(&"partnumber".to_string()) @@ -125,8 +125,8 @@ async fn handler_inner(garage: Arc, req: Request) -> Result, req: Request) -> Result { if params.contains_key(&"uploadid".to_string()) { // AbortMultipartUpload query let upload_id = params.get("uploadid").unwrap(); - Ok(handle_abort_multipart_upload(garage, &bucket, &key, upload_id).await?) + Ok(handle_abort_multipart_upload(garage, bucket, key, upload_id).await?) } else { // DeleteObject query - Ok(handle_delete(garage, &bucket, &key).await?) + Ok(handle_delete(garage, bucket, key).await?) } } Method::POST => { if params.contains_key(&"uploads".to_string()) { // CreateMultipartUpload call - Ok(handle_create_multipart_upload(garage, &req, &bucket, &key).await?) + Ok(handle_create_multipart_upload(garage, &req, bucket, key).await?) } else if params.contains_key(&"uploadid".to_string()) { // CompleteMultipartUpload call let upload_id = params.get("uploadid").unwrap(); Ok(handle_complete_multipart_upload( garage, req, - &bucket, - &key, + bucket, + key, upload_id, content_sha256, ) -- cgit v1.2.3