From 59612b9fa3c4cde3a50a6252c79aebc2247da1e5 Mon Sep 17 00:00:00 2001 From: rmarinn <34529290+rmarinn@users.noreply.github.com> Date: Wed, 6 Nov 2024 17:31:20 +0800 Subject: [PATCH] refactor(jans-cedarling): replace if statement with match Signed-off-by: rmarinn <34529290+rmarinn@users.noreply.github.com> --- jans-cedarling/cedarling/src/jwt/decoding_strategy.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jans-cedarling/cedarling/src/jwt/decoding_strategy.rs b/jans-cedarling/cedarling/src/jwt/decoding_strategy.rs index 24a1fe92e22..7c766d50dd1 100644 --- a/jans-cedarling/cedarling/src/jwt/decoding_strategy.rs +++ b/jans-cedarling/cedarling/src/jwt/decoding_strategy.rs @@ -168,11 +168,10 @@ fn decode_and_validate_jwt( validator.required_spec_claims.clear(); validator.validate_nbf = args.validate_nbf; validator.validate_exp = args.validate_exp; - if args.aud.is_none() { - validator.validate_aud = false; - } else { - validator.aud.set_optional_claim(args.aud); - } + match args.aud { + Some(_) => validator.aud.set_optional_claim(args.aud), + None => validator.validate_aud = false, + }; validator.iss.set_optional_claim(args.iss); validator.sub.set_optional_claim(args.sub);