From 51505b86dba949189b63bc6db9edda5d7e187af4 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 1 Dec 2023 11:24:31 +0100 Subject: [PATCH] clippy --- scripts/lint.sh | 2 +- src/session_middleware.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/lint.sh b/scripts/lint.sh index 924fba390..6a9526dfc 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -5,7 +5,7 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" cd $CWD/../ -cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-targets --all-features -- -D warnings +cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-targets -- -D warnings # Format rust files cargo +nightly fmt diff --git a/src/session_middleware.rs b/src/session_middleware.rs index 4e7ab1d07..bdecb9818 100644 --- a/src/session_middleware.rs +++ b/src/session_middleware.rs @@ -76,7 +76,7 @@ where if let Err(e) = &local_user_view { warn!("Failed to handle user login: {e}"); } - if let Some(local_user_view) = local_user_view.ok() { + if let Ok(local_user_view) = local_user_view { req.extensions_mut().insert(local_user_view); } } @@ -86,9 +86,8 @@ where // Add cache-control header. If user is authenticated, mark as private. Otherwise cache // up to one minute. - let cache_value = if jwt.is_some() { - "private" - } else if context.settings().disable_cache_control.unwrap_or(false) { + let disable_cache = context.settings().disable_cache_control.unwrap_or(false); + let cache_value = if jwt.is_some() || disable_cache { "private" } else { "public, max-age=60"