Skip to content

Commit 9567136

Browse files
committed
Use &mut instead of .as_mut()
1 parent 44d4e92 commit 9567136

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/util/storable_builder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ impl StorableBuilder {
5151
pub fn deconstruct(&self, mut storable: Storable) -> io::Result<(Vec<u8>, i64)> {
5252
let encryption_metadata = storable.encryption_metadata.unwrap();
5353
let mut cipher = ChaCha20Poly1305::new(&self.data_encryption_key, &encryption_metadata.nonce, &[]);
54-
let input_output = storable.data.as_mut();
5554

56-
if cipher.decrypt_inplace(input_output, encryption_metadata.tag.borrow()) {
57-
let data_blob = PlaintextBlob::decode(&input_output[..]).map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
55+
if cipher.decrypt_inplace(&mut storable.data, encryption_metadata.tag.borrow()) {
56+
let data_blob = PlaintextBlob::decode(&storable.data[..]).map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
5857
Ok((data_blob.value, data_blob.version))
5958
} else {
6059
Err(Error::new(ErrorKind::InvalidData, "Invalid Tag"))

0 commit comments

Comments
 (0)