From 100d7b6e1cb617aff66ca2a0ab7e301764bde9d3 Mon Sep 17 00:00:00 2001 From: Karolin Varner Date: Mon, 17 Jun 2024 13:55:37 +0200 Subject: [PATCH] chore: Simplify some dereferencing incantations in PublicBox --- secret-memory/src/public.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/secret-memory/src/public.rs b/secret-memory/src/public.rs index c06723f..6a93613 100644 --- a/secret-memory/src/public.rs +++ b/secret-memory/src/public.rs @@ -311,13 +311,13 @@ impl PublicBox { /// Randomize all bytes in an existing [PublicBox] pub fn randomize(&mut self) { - (**self).try_fill(&mut crate::rand::rng()).unwrap() + self.inner.randomize() } } impl Randomize for PublicBox { fn try_fill(&mut self, rng: &mut R) -> Result<(), rand::Error> { - (**self).try_fill(rng) + self.inner.try_fill(rng) } } @@ -331,25 +331,25 @@ impl Deref for PublicBox { type Target = [u8; N]; fn deref(&self) -> &[u8; N] { - &*self.inner + self.inner.deref() } } impl DerefMut for PublicBox { fn deref_mut(&mut self) -> &mut [u8; N] { - &mut *self.inner + self.inner.deref_mut() } } impl Borrow<[u8]> for PublicBox { fn borrow(&self) -> &[u8] { - &**self + self.deref() } } impl BorrowMut<[u8]> for PublicBox { fn borrow_mut(&mut self) -> &mut [u8] { - &mut **self + self.deref_mut() } }