We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15d40e2 commit 1b10555Copy full SHA for 1b10555
src/rust/src/backend/kdf.rs
@@ -545,15 +545,17 @@ impl BaseArgon2 {
545
_ => None,
546
};
547
548
- if requested_variant.is_none() {
549
- return Err(CryptographyError::from(exceptions::InvalidKey::new_err(
+ let requested_variant = requested_variant.ok_or_else(|| {
+ CryptographyError::from(exceptions::InvalidKey::new_err(
550
"Invalid PHC string format.",
551
- )));
552
- } else if requested_variant.unwrap() != variant {
+ ))
+ })?;
553
+
554
+ if requested_variant != variant {
555
return Err(CryptographyError::from(exceptions::InvalidKey::new_err(
556
format!(
557
"Incorrect variant in PHC string, did you mean to use {:?}?",
- requested_variant.unwrap()
558
+ requested_variant
559
),
560
)));
561
}
0 commit comments