From e88297eb165bc680bfaa7adc3f5feaf3691bf51c Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 20 Jun 2025 10:41:35 -0600 Subject: refactor: collapse object initializers into a single one --- src/authorization/cedar_authorizer.rs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs index ff4c3c5b..cefdef2b 100644 --- a/src/authorization/cedar_authorizer.rs +++ b/src/authorization/cedar_authorizer.rs @@ -51,22 +51,20 @@ mod tests { } fn create_test_request_with_headers(headers: HashMap) -> CheckRequest { - let http_request = build_with::( - |mut item: attribute_context::HttpRequest| { - item.headers = headers; - item - }, - ); - - let request_context = attribute_context::Request { - http: Some(http_request), - ..Default::default() - }; - - let attributes = AttributeContext { - request: Some(request_context), - ..Default::default() - }; + let attributes = build_with::(|mut item: AttributeContext| { + item.request = Some(build_with::( + |mut item: attribute_context::Request| { + item.http = Some(build_with::( + |mut item: attribute_context::HttpRequest| { + item.headers = headers; + item + }, + )); + item + }, + )); + item + }); CheckRequest { attributes: Some(attributes), -- cgit v1.2.3