From 42ee52dc8df0dc3c074d3629255652e80d1c199b Mon Sep 17 00:00:00 2001 From: Christopher Greenwood Date: Mon, 15 Aug 2022 09:34:58 -0700 Subject: [PATCH] fix clippy warnings in unit tests not sure if there's a way for `cargo clippy` to lint the tests by default... --- lambda-http/src/request.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lambda-http/src/request.rs b/lambda-http/src/request.rs index fba1935c..c7ba1e20 100644 --- a/lambda-http/src/request.rs +++ b/lambda-http/src/request.rs @@ -472,10 +472,7 @@ mod tests { // Ensure this is an APIGWv2 request let req_context = req.request_context(); assert!( - match req_context { - RequestContext::ApiGatewayV2(_) => true, - _ => false, - }, + matches!(req_context, RequestContext::ApiGatewayV2(_)), "expected ApiGatewayV2 context, got {:?}", req_context ); @@ -507,10 +504,7 @@ mod tests { // Ensure this is an APIGWv2 request let req_context = req.request_context(); assert!( - match req_context { - RequestContext::ApiGatewayV2(_) => true, - _ => false, - }, + matches!(req_context, RequestContext::ApiGatewayV2(_)), "expected ApiGatewayV2 context, got {:?}", req_context ); @@ -539,10 +533,7 @@ mod tests { // Ensure this is an APIGW request let req_context = req.request_context(); assert!( - match req_context { - RequestContext::ApiGatewayV1(_) => true, - _ => false, - }, + matches!(req_context, RequestContext::ApiGatewayV1(_)), "expected ApiGateway context, got {:?}", req_context ); @@ -570,10 +561,7 @@ mod tests { // Ensure this is an ALB request let req_context = req.request_context(); assert!( - match req_context { - RequestContext::Alb(_) => true, - _ => false, - }, + matches!(req_context, RequestContext::Alb(_)), "expected Alb context, got {:?}", req_context );