mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 02:25:41 +00:00
addressing clippy lints
This commit is contained in:
@@ -58,7 +58,7 @@ async fn delete_account(
|
||||
}
|
||||
}
|
||||
Err(RowNotFound) => return Err(ServiceError::UsernameNotFound),
|
||||
Err(_) => return Err(ServiceError::InternalServerError)?,
|
||||
Err(_) => return Err(ServiceError::InternalServerError),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,14 +74,14 @@ async fn set_email(
|
||||
)
|
||||
.execute(&data.db)
|
||||
.await;
|
||||
if !res.is_ok() {
|
||||
if res.is_err() {
|
||||
if let Err(sqlx::Error::Database(err)) = res {
|
||||
if err.code() == Some(Cow::from("23505"))
|
||||
&& err.message().contains("mcaptcha_users_email_key")
|
||||
{
|
||||
Err(ServiceError::EmailTaken)?
|
||||
return Err(ServiceError::EmailTaken);
|
||||
} else {
|
||||
Err(sqlx::Error::Database(err))?
|
||||
return Err(sqlx::Error::Database(err).into());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ pub mod routes {
|
||||
pub struct Account {
|
||||
pub delete: &'static str,
|
||||
pub email_exists: &'static str,
|
||||
pub update_email: &'static str,
|
||||
pub get_secret: &'static str,
|
||||
pub update_email: &'static str,
|
||||
pub update_secret: &'static str,
|
||||
pub username_exists: &'static str,
|
||||
}
|
||||
@@ -47,12 +47,13 @@ pub mod routes {
|
||||
let username_exists = "/api/v1/account/username/exists";
|
||||
let update_email = "/api/v1/account/email/update";
|
||||
Account {
|
||||
get_secret,
|
||||
update_secret,
|
||||
username_exists,
|
||||
update_email,
|
||||
delete,
|
||||
email_exists,
|
||||
|
||||
get_secret,
|
||||
update_email,
|
||||
update_secret,
|
||||
username_exists,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,16 +71,14 @@ async fn update_user_secret(
|
||||
.await;
|
||||
if res.is_ok() {
|
||||
break;
|
||||
} else {
|
||||
if let Err(sqlx::Error::Database(err)) = res {
|
||||
if err.code() == Some(Cow::from("23505"))
|
||||
&& err.message().contains("mcaptcha_users_secret_key")
|
||||
{
|
||||
continue;
|
||||
} else {
|
||||
Err(sqlx::Error::Database(err))?;
|
||||
}
|
||||
};
|
||||
} else if let Err(sqlx::Error::Database(err)) = res {
|
||||
if err.code() == Some(Cow::from("23505"))
|
||||
&& err.message().contains("mcaptcha_users_secret_key")
|
||||
{
|
||||
continue;
|
||||
} else {
|
||||
return Err(sqlx::Error::Database(err).into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(HttpResponse::Ok())
|
||||
|
||||
Reference in New Issue
Block a user