From 57c7bd667bc9fc809d1e1ee49c0696a13d3bfd8d Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 20 Jun 2025 10:43:27 -0600 Subject: refactor: collapse initializers in a functional chain --- src/authorization/cedar_authorizer.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs index cefdef2b..cc1fc93b 100644 --- a/src/authorization/cedar_authorizer.rs +++ b/src/authorization/cedar_authorizer.rs @@ -51,12 +51,17 @@ mod tests { } fn create_test_request_with_headers(headers: HashMap) -> CheckRequest { - 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; + build_with::(|mut item: CheckRequest| { + item.attributes = Some(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 }, )); @@ -64,12 +69,7 @@ mod tests { }, )); item - }); - - CheckRequest { - attributes: Some(attributes), - ..Default::default() - } + }) } #[test] -- cgit v1.2.3