Skip to content

Commit 1b10555

Browse files
authored
fix clippy warning in latest rust (#13802)
1 parent 15d40e2 commit 1b10555

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/rust/src/backend/kdf.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,17 @@ impl BaseArgon2 {
545545
_ => None,
546546
};
547547

548-
if requested_variant.is_none() {
549-
return Err(CryptographyError::from(exceptions::InvalidKey::new_err(
548+
let requested_variant = requested_variant.ok_or_else(|| {
549+
CryptographyError::from(exceptions::InvalidKey::new_err(
550550
"Invalid PHC string format.",
551-
)));
552-
} else if requested_variant.unwrap() != variant {
551+
))
552+
})?;
553+
554+
if requested_variant != variant {
553555
return Err(CryptographyError::from(exceptions::InvalidKey::new_err(
554556
format!(
555557
"Incorrect variant in PHC string, did you mean to use {:?}?",
556-
requested_variant.unwrap()
558+
requested_variant
557559
),
558560
)));
559561
}

0 commit comments

Comments
 (0)