Skip to content

Commit

Permalink
Minor clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Aug 15, 2024
1 parent dac80c0 commit 1f4f828
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/protected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,25 +1423,20 @@ impl<A: Zeroize + Bytes, PM: traits::ProtectMode, LM: traits::LockMode> Zeroize
for Protected<A, PM, LM>
{
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 => (),
}
}
}
Expand Down

0 comments on commit 1f4f828

Please sign in to comment.