Skip to content

Commit

Permalink
move derefmut out too
Browse files Browse the repository at this point in the history
  • Loading branch information
reaperhulk committed Sep 1, 2024
1 parent ff6dcd9 commit 5212bdc
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions openssl/src/md.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ use foreign_types::{ForeignTypeRef, Opaque};
use openssl_macros::corresponds;
#[cfg(ossl300)]
use std::ffi::CString;
use std::ops::Deref;
use std::ops::{Deref, DerefMut};
#[cfg(ossl300)]
use std::ptr;

cfg_if! {
if #[cfg(ossl300)] {
use std::ops::DerefMut;

impl Drop for Md {
#[inline]
fn drop(&mut self) {
Expand All @@ -29,15 +27,6 @@ cfg_if! {
}
}
}

impl DerefMut for Md {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe {
MdRef::from_ptr_mut(self.as_ptr())
}
}
}
}
}

Expand Down Expand Up @@ -65,6 +54,13 @@ impl Deref for Md {
}
}

impl DerefMut for Md {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { MdRef::from_ptr_mut(self.as_ptr()) }
}
}

/// A message digest algorithm.
pub struct Md(*mut ffi::EVP_MD);

Expand Down

0 comments on commit 5212bdc

Please sign in to comment.