Skip to content

Commit

Permalink
Fix compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Nov 20, 2024
1 parent 1e55bec commit 0809a57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aead/src/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Error, Result};
use crate::Result;

#[cfg(feature = "alloc")]
use alloc::vec::Vec;
Expand Down Expand Up @@ -65,15 +65,15 @@ impl<const N: usize> Buffer for ArrayVec<u8, N> {
fn resize(&mut self, len: usize) -> Result<()> {
if let Some(ext_len) = len.checked_sub(self.len()) {
let buf = &[0u8; N][..ext_len];
self.try_extend_from_slice(buf).map_err(|_| Error)
self.try_extend_from_slice(buf).map_err(|_| crate::Error)
} else {
self.truncate(len);
Ok(())
}
}

fn extend_from_slice(&mut self, other: &[u8]) -> Result<()> {
ArrayVec::try_extend_from_slice(self, other).map_err(|_| Error)
ArrayVec::try_extend_from_slice(self, other).map_err(|_| crate::Error)
}

fn truncate(&mut self, len: usize) {
Expand All @@ -84,11 +84,11 @@ impl<const N: usize> Buffer for ArrayVec<u8, N> {
#[cfg(feature = "heapless")]
impl<const N: usize> Buffer for heapless::Vec<u8, N> {
fn resize(&mut self, len: usize) -> Result<()> {
heapless::Vec::resize(self, len, 0).map_err(|_| Error)
heapless::Vec::resize(self, len, 0).map_err(|_| crate::Error)
}

fn extend_from_slice(&mut self, other: &[u8]) -> Result<()> {
heapless::Vec::extend_from_slice(self, other).map_err(|_| Error)
heapless::Vec::extend_from_slice(self, other).map_err(|_| crate::Error)
}

fn truncate(&mut self, len: usize) {
Expand Down

0 comments on commit 0809a57

Please sign in to comment.