From dd805dcacb8cd0b3d6fbd92dc13ce6826af6644e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:29:01 +0000 Subject: [PATCH] Optimize JwtLayer to avoid redundant struct clones Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com> --- crates/rustapi-extras/src/jwt/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/rustapi-extras/src/jwt/mod.rs b/crates/rustapi-extras/src/jwt/mod.rs index fe70eaa..5a96174 100644 --- a/crates/rustapi-extras/src/jwt/mod.rs +++ b/crates/rustapi-extras/src/jwt/mod.rs @@ -97,7 +97,7 @@ impl JwtValidation { #[derive(Clone)] pub struct JwtLayer { secret: Arc, - validation: JwtValidation, + validation: Arc, skip_paths: Arc>, _claims: PhantomData, } @@ -107,7 +107,7 @@ impl JwtLayer { pub fn new(secret: impl Into) -> Self { Self { secret: Arc::new(secret.into()), - validation: JwtValidation::default(), + validation: Arc::new(JwtValidation::default()), skip_paths: Arc::new(Vec::new()), _claims: PhantomData, } @@ -115,7 +115,7 @@ impl JwtLayer { /// Configure custom validation options. pub fn with_validation(mut self, validation: JwtValidation) -> Self { - self.validation = validation; + self.validation = Arc::new(validation); self }