Skip to content

Commit

Permalink
Merge pull request #3 from bombsimon/master
Browse files Browse the repository at this point in the history
Fix clippy warnings
  • Loading branch information
bombsimon authored May 6, 2020
2 parents e56337f + 7f72b78 commit 4df1ac7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ impl Personnummer {
).unwrap();
}

let cap = PNR_REGEX.captures(pnr);
if cap.is_none() {
return None;
}

let caps = cap.unwrap();
let caps = PNR_REGEX.captures(pnr)?;

let century = match caps.name("century") {
Some(m) => m.as_str().parse::<u32>().unwrap_or(19) * 100,
Expand Down Expand Up @@ -119,14 +114,14 @@ impl Personnummer {
day
};

let long = String::from(format!(
let long = format!(
"{}{:02}{:02}-{:03}{}",
self.date.year(),
self.date.month(),
day_or_coordination,
self.serial,
self.control
));
);

let short = String::from(&long.clone()[2..]);

Expand Down

0 comments on commit 4df1ac7

Please # to comment.