From 97a085d37e2fb11636eaf9383cebf2cd39cb4421 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Mon, 10 Jul 2023 13:17:31 +0200 Subject: [PATCH] smol refactor --- src/auth/session.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/auth/session.rs b/src/auth/session.rs index 268f6ff..2840980 100644 --- a/src/auth/session.rs +++ b/src/auth/session.rs @@ -83,9 +83,8 @@ impl Session { .fetch_optional(pool) .await?; - match record { - None => Ok(None), - Some(record) => Ok(Some(( + Ok(record.map(|record| { + ( Self { id: record.session_id, actor: record.session_actor, @@ -105,8 +104,8 @@ impl Session { modified_at: record.modified_at, deleted_at: record.deleted_at, }, - ))), - } + ) + })) } pub async fn refresh(self, pool: &Pool, duration: Duration) -> Result {