Fix cargo clippy issues
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-28 08:15:50 +02:00
parent 6e53486832
commit 0540f515ec
6 changed files with 29 additions and 43 deletions

View File

@@ -95,11 +95,10 @@ fn check_opt_str_val(
c: SizeConstraint,
err: MemberControllerErr,
) -> anyhow::Result<()> {
if let Some(v) = val {
if !c.validate(v) {
if let Some(v) = val
&& !c.validate(v) {
return Err(err.into());
}
}
Ok(())
}
@@ -151,11 +150,10 @@ impl MemberRequest {
MemberControllerErr::MalformedEmailAddress,
)?;
if let Some(mail) = &self.email {
if !mailchecker::is_valid(mail) {
if let Some(mail) = &self.email
&& !mailchecker::is_valid(mail) {
return Err(MemberControllerErr::InvalidEmailAddress.into());
}
}
check_opt_str_val(
&self.phone,
@@ -187,23 +185,20 @@ impl MemberRequest {
MemberControllerErr::MalformedCountry,
)?;
if let Some(c) = &self.country {
if !countries_utils::is_code_valid(c) {
if let Some(c) = &self.country
&& !countries_utils::is_code_valid(c) {
return Err(MemberControllerErr::InvalidCountryCode.into());
}
}
if let Some(d) = &self.birth {
if !d.check() {
if let Some(d) = &self.birth
&& !d.check() {
return Err(MemberControllerErr::MalformedDateOfBirth.into());
}
}
if let Some(d) = &self.death {
if !d.check() {
if let Some(d) = &self.death
&& !d.check() {
return Err(MemberControllerErr::MalformedDateOfDeath.into());
}
}
check_opt_str_val(
&self.note,
@@ -221,11 +216,10 @@ impl MemberRequest {
}
}
if let Some(father) = self.father {
if !members_service::exists(member.family_id(), father).await? {
if let Some(father) = self.father
&& !members_service::exists(member.family_id(), father).await? {
return Err(MemberControllerErr::FatherNotExisting.into());
}
}
member.first_name = self.first_name;
member.last_name = self.last_name;