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/users.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'planetwars-server/src/db/users.rs') diff --git a/planetwars-server/src/db/users.rs b/planetwars-server/src/db/users.rs index a97ade5..3c071de 100644 --- a/planetwars-server/src/db/users.rs +++ b/planetwars-server/src/db/users.rs @@ -48,7 +48,7 @@ pub fn create_user(credentials: &Credentials, conn: &PgConnection) -> QueryResul let salt: [u8; 32] = rand::thread_rng().gen(); let hash = argon2::hash_raw(credentials.password.as_bytes(), &salt, &argon_config).unwrap(); let new_user = NewUser { - username: &credentials.username, + username: credentials.username, password_salt: &salt, password_hash: &hash, }; @@ -73,9 +73,9 @@ pub fn authenticate_user(credentials: &Credentials, db_conn: &PgConnection) -> O .unwrap(); if password_matches { - return Some(user); + Some(user) } else { - return None; + None } }) } @@ -91,15 +91,15 @@ fn test_argon() { let salt: [u8; 32] = rand::thread_rng().gen(); let hash = argon2::hash_raw(credentials.password.as_bytes(), &salt, &argon_config).unwrap(); let new_user = NewUser { - username: &credentials.username, + username: credentials.username, password_hash: &hash, password_salt: &salt, }; let password_matches = argon2::verify_raw( credentials.password.as_bytes(), - &new_user.password_salt, - &new_user.password_hash, + new_user.password_salt, + new_user.password_hash, &argon2_config(), ) .unwrap(); -- cgit v1.2.3