[style](trx-client, trx-frontend-http): fix clippy warnings
- Derive Default for SameSite enum in auth.rs using #[default] attribute - Derive Default for CookieSameSite enum in config.rs - Replace and_then(|x| Some(y)) with map(|x| y) in extract_session_id() All clippy warnings resolved. Tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -132,9 +132,10 @@ impl Default for SessionStore {
|
||||
}
|
||||
|
||||
/// Cookie SameSite attribute
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum SameSite {
|
||||
Strict,
|
||||
#[default]
|
||||
Lax,
|
||||
None,
|
||||
}
|
||||
@@ -149,12 +150,6 @@ impl SameSite {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SameSite {
|
||||
fn default() -> Self {
|
||||
Self::Lax
|
||||
}
|
||||
}
|
||||
|
||||
/// Runtime authentication configuration
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AuthConfig {
|
||||
@@ -260,7 +255,7 @@ pub struct LoginResponse {
|
||||
/// Extract session from cookie
|
||||
fn extract_session_id(req: &HttpRequest) -> Option<SessionId> {
|
||||
req.cookie("trx_http_sid")
|
||||
.and_then(|cookie| Some(cookie.value().to_string()))
|
||||
.map(|cookie| cookie.value().to_string())
|
||||
}
|
||||
|
||||
/// Get session from request, return role if valid
|
||||
|
||||
Reference in New Issue
Block a user