Skip to content

Commit

Permalink
Fix clippy issues
Browse files Browse the repository at this point in the history
The first issue was clippy::collapsible_else_if warning
https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
and with that resolved, clippy::if_same_then_else deny emerged
https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
  • Loading branch information
mbergkvist authored and bombsimon committed Jun 30, 2024
1 parent b883b03 commit 61ddfb0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,12 @@ impl Personnummer {
pub fn get_age(&self) -> i32 {
let now = Utc::now();

if self.date.month() > now.month() {
if self.date.month() > now.month()
|| self.date.month() == now.month() && self.date.day() > now.day()
{
now.year() - self.date.year() - 1
} else {
if self.date.month() == now.month() && self.date.day() > now.day() {
now.year() - self.date.year() - 1
} else {
now.year() - self.date.year()
}
now.year() - self.date.year()
}
}

Expand Down

0 comments on commit 61ddfb0

Please sign in to comment.