mirror of
https://github.com/bitwarden/browser
synced 2025-12-24 04:04:24 +00:00
Remove allow(clippy::question_mark) (#16565)
Remove the allow(clippy::question_mark) exception by reworking the code to use ?.
This commit is contained in:
@@ -6,16 +6,13 @@ use aes::cipher::{
|
||||
block_padding::Pkcs7, generic_array::GenericArray, typenum::U32, BlockDecryptMut, KeyIvInit,
|
||||
};
|
||||
|
||||
#[allow(clippy::question_mark)]
|
||||
pub fn decrypt_aes256(iv: &[u8; 16], data: &[u8], key: GenericArray<u8, U32>) -> Result<Vec<u8>> {
|
||||
let iv = GenericArray::from_slice(iv);
|
||||
let mut data = data.to_vec();
|
||||
let result = cbc::Decryptor::<aes::Aes256>::new(&key, iv)
|
||||
cbc::Decryptor::<aes::Aes256>::new(&key, iv)
|
||||
.decrypt_padded_mut::<Pkcs7>(&mut data)
|
||||
.map_err(|_| anyhow!("Failed to decrypt data"));
|
||||
if let Err(e) = result {
|
||||
return Err(e);
|
||||
}
|
||||
.map_err(|_| anyhow!("Failed to decrypt data"))?;
|
||||
|
||||
Ok(data)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user