From ba6b56ae68d5842d814769418d484093865261aa Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 14 Mar 2022 12:00:23 +0100 Subject: Fix some new clippy lints --- src/api/s3_cors.rs | 7 +------ src/api/s3_list.rs | 6 +++--- src/api/s3_website.rs | 3 +-- src/api/signature/payload.rs | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/api') diff --git a/src/api/s3_cors.rs b/src/api/s3_cors.rs index e3deaeda..ab77e23a 100644 --- a/src/api/s3_cors.rs +++ b/src/api/s3_cors.rs @@ -200,12 +200,7 @@ pub fn find_matching_cors_rule<'a>( None => vec![], }; return Ok(cors_config.iter().find(|rule| { - cors_rule_matches( - rule, - origin, - &req.method().to_string(), - request_headers.iter(), - ) + cors_rule_matches(rule, origin, req.method().as_ref(), request_headers.iter()) })); } } diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs index 92998159..5852fc1b 100644 --- a/src/api/s3_list.rs +++ b/src/api/s3_list.rs @@ -1042,12 +1042,12 @@ mod tests { query.common.prefix = "a/".to_string(); assert_eq!( - common_prefix(&objs.get(0).unwrap(), &query.common), + common_prefix(objs.get(0).unwrap(), &query.common), Some("a/b/") ); query.common.prefix = "a/b/".to_string(); - assert_eq!(common_prefix(&objs.get(0).unwrap(), &query.common), None); + assert_eq!(common_prefix(objs.get(0).unwrap(), &query.common), None); } #[test] @@ -1272,7 +1272,7 @@ mod tests { Version { bucket_id: uuid, key: "a".to_string(), - uuid: uuid, + uuid, deleted: false.into(), blocks: crdt::Map::::from_iter(blocks), parts_etags: crdt::Map::::from_iter(etags), diff --git a/src/api/s3_website.rs b/src/api/s3_website.rs index 9d1da905..b464dd45 100644 --- a/src/api/s3_website.rs +++ b/src/api/s3_website.rs @@ -259,8 +259,7 @@ impl RoutingRuleInner { let has_prefix = self .condition .as_ref() - .map(|c| c.prefix.as_ref()) - .flatten() + .and_then(|c| c.prefix.as_ref()) .is_some(); self.redirect.validate(has_prefix) } diff --git a/src/api/signature/payload.rs b/src/api/signature/payload.rs index 85687a23..88b58922 100644 --- a/src/api/signature/payload.rs +++ b/src/api/signature/payload.rs @@ -51,7 +51,7 @@ pub async fn check_payload_signature( let canonical_request = canonical_request( request.method(), - &request.uri().path().to_string(), + request.uri().path(), &canonical_query_string(request.uri()), &headers, &authorization.signed_headers, -- cgit v1.2.3