From 1f4f8283a9cba9d866f2ae48cd9d49da68b3078d Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Thu, 15 Aug 2024 10:05:52 -0400 Subject: [PATCH] Minor clippy fix --- src/protected.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/protected.rs b/src/protected.rs index 198c658..80c52c6 100644 --- a/src/protected.rs +++ b/src/protected.rs @@ -1423,25 +1423,20 @@ impl Zeroize for Protected { fn zeroize(&mut self) { - match &mut self.i { - Some(d) => { - if !d.a.as_slice().is_empty() { - if d.pm != int::ProtectMode::ReadWrite { - dryoc_mprotect_readwrite(d.a.as_slice()) - .map_err(|err| { - eprintln!("mprotect_readwrite error on drop = {:?}", err) - }) - .ok(); - } - d.a.zeroize(); - if d.lm == int::LockMode::Locked { - dryoc_munlock(d.a.as_slice()) - .map_err(|err| eprintln!("dryoc_munlock error on drop = {:?}", err)) - .ok(); - } + if let Some(d) = &mut self.i { + if !d.a.as_slice().is_empty() { + if d.pm != int::ProtectMode::ReadWrite { + dryoc_mprotect_readwrite(d.a.as_slice()) + .map_err(|err| eprintln!("mprotect_readwrite error on drop = {:?}", err)) + .ok(); + } + d.a.zeroize(); + if d.lm == int::LockMode::Locked { + dryoc_munlock(d.a.as_slice()) + .map_err(|err| eprintln!("dryoc_munlock error on drop = {:?}", err)) + .ok(); } } - None => (), } } }