Skip to content

Commit 120f8c6

Browse files
committed
Fix clippy errors
1 parent b913762 commit 120f8c6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

crates/bitwarden-crypto/src/safe/password_protected_key_envelope.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,19 @@ impl TryInto<Argon2RawSettings> for Header {
286286
))?;
287287

288288
Ok(Argon2RawSettings {
289-
iterations: i128::from(*iterations).try_into().unwrap(),
290-
memory: i128::from(*memory).try_into().unwrap(),
291-
parallelism: i128::from(*parallelism).try_into().unwrap(),
289+
iterations: i128::from(*iterations).try_into().map_err(|_| {
290+
PasswordProtectedKeyEnvelopeError::ParsingError(
291+
"Invalid Argon2 iterations".to_string(),
292+
)
293+
})?,
294+
memory: i128::from(*memory).try_into().map_err(|_| {
295+
PasswordProtectedKeyEnvelopeError::ParsingError("Invalid Argon2 memory".to_string())
296+
})?,
297+
parallelism: i128::from(*parallelism).try_into().map_err(|_| {
298+
PasswordProtectedKeyEnvelopeError::ParsingError(
299+
"Invalid Argon2 parallelism".to_string(),
300+
)
301+
})?,
292302
salt,
293303
})
294304
}

0 commit comments

Comments
 (0)