From fd52e266c6e25999a49c36f17342977b759a2612 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 13 Mar 2022 15:20:03 +0100 Subject: apply clippy suggestions --- planetwars-server/src/db/sessions.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'planetwars-server/src/db/sessions.rs') diff --git a/planetwars-server/src/db/sessions.rs b/planetwars-server/src/db/sessions.rs index 96f3926..a91d954 100644 --- a/planetwars-server/src/db/sessions.rs +++ b/planetwars-server/src/db/sessions.rs @@ -24,12 +24,11 @@ pub fn create_session(user: &User, conn: &PgConnection) -> Session { token: gen_session_token(), user_id: user.id, }; - let session = insert_into(sessions::table) + + insert_into(sessions::table) .values(&new_session) .get_result::(conn) - .unwrap(); - - return session; + .unwrap() } pub fn find_user_by_session(token: &str, conn: &PgConnection) -> QueryResult<(Session, User)> { @@ -42,5 +41,5 @@ pub fn find_user_by_session(token: &str, conn: &PgConnection) -> QueryResult<(Se pub fn gen_session_token() -> String { let mut rng = rand::thread_rng(); let token: [u8; 32] = rng.gen(); - return base64::encode(&token); + base64::encode(&token) } -- cgit v1.2.3