Fold a few panics
Removes a few panics we don't need by folding them in the Error case of their enclosing Result return.
This commit is contained in:
+2
-1
@@ -35,7 +35,8 @@ impl<D: Hash> SlowHash<D> for scrypt::ScryptParams {
|
||||
fn hash(
|
||||
input: GenericArray<u8, <D as Digest>::OutputSize>,
|
||||
) -> Result<Vec<u8>, InternalPakeError> {
|
||||
let params = scrypt::ScryptParams::new(15, 8, 1).unwrap();
|
||||
let params =
|
||||
scrypt::ScryptParams::new(15, 8, 1).map_err(|_| InternalPakeError::SlowHashError)?;
|
||||
let mut output = vec![0u8; <D as Digest>::OutputSize::to_usize()];
|
||||
scrypt::scrypt(&input, &[], ¶ms, &mut output)
|
||||
.map_err(|_| InternalPakeError::SlowHashError)?;
|
||||
|
||||
Reference in New Issue
Block a user