Skip to content

Commit

Permalink
fix: clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Aug 4, 2023
1 parent bc04231 commit 8fe0955
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/services/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,17 @@ impl RegistrationService {
drop(self.user_repository.grant_admin_role(&user_id).await);
}

if settings.mail.email_verification_enabled && opt_email.is_some() {
let mail_res = self
.mailer
.send_verification_mail(
&opt_email.expect("variable `email` is checked above"),
&registration_form.username,
user_id,
api_base_url,
)
.await;

if mail_res.is_err() {
drop(self.user_repository.delete(&user_id).await);
return Err(ServiceError::FailedToSendVerificationEmail);
if settings.mail.email_verification_enabled {
if let Some(email) = opt_email {
let mail_res = self
.mailer
.send_verification_mail(&email, &registration_form.username, user_id, api_base_url)
.await;

if mail_res.is_err() {
drop(self.user_repository.delete(&user_id).await);
return Err(ServiceError::FailedToSendVerificationEmail);
}
}
}

Expand Down

0 comments on commit 8fe0955

Please sign in to comment.