fix: apply lints suggested by clippy

master
Aravinth Manivannan 2022-02-12 18:25:03 +05:30
parent b28a7d0cfb
commit aa4d205742
1 changed files with 8 additions and 14 deletions

View File

@ -160,17 +160,14 @@ impl GistDatabase for Database {
} }
async fn email_exists(&self, email: &str) -> DBResult<bool> { async fn email_exists(&self, email: &str) -> DBResult<bool> {
let exists;
match sqlx::query!("SELECT id from admin_users WHERE email = $1", email) match sqlx::query!("SELECT id from admin_users WHERE email = $1", email)
.fetch_one(&self.pool) .fetch_one(&self.pool)
.await .await
{ {
Ok(_) => exists = true, Ok(_) => Ok(true),
Err(Error::RowNotFound) => exists = false, Err(Error::RowNotFound) => Ok(false),
Err(e) => return Err(DBError::DBError(Box::new(e))), Err(e) => Err(DBError::DBError(Box::new(e))),
}; }
Ok(exists)
} }
async fn delete_account(&self, username: &str) -> DBResult<()> { async fn delete_account(&self, username: &str) -> DBResult<()> {
@ -182,17 +179,14 @@ impl GistDatabase for Database {
} }
async fn username_exists(&self, username: &str) -> DBResult<bool> { async fn username_exists(&self, username: &str) -> DBResult<bool> {
let exists;
match sqlx::query!("SELECT id from admin_users WHERE username = $1", username) match sqlx::query!("SELECT id from admin_users WHERE username = $1", username)
.fetch_one(&self.pool) .fetch_one(&self.pool)
.await .await
{ {
Ok(_) => exists = true, Ok(_) => Ok(true),
Err(Error::RowNotFound) => exists = false, Err(Error::RowNotFound) => Ok(false),
Err(e) => return Err(DBError::DBError(Box::new(e))), Err(e) => Err(DBError::DBError(Box::new(e))),
}; }
Ok(exists)
} }
async fn update_username(&self, payload: &UpdateUsernamePayload) -> DBResult<()> { async fn update_username(&self, payload: &UpdateUsernamePayload) -> DBResult<()> {