From 5212bdcabfd1c5ca85124678b9da67faf8c0df33 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 1 Sep 2024 14:28:51 -0700 Subject: [PATCH] move derefmut out too --- openssl/src/md.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/openssl/src/md.rs b/openssl/src/md.rs index 5332c9a72..9589b21bd 100644 --- a/openssl/src/md.rs +++ b/openssl/src/md.rs @@ -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) { @@ -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()) - } - } - } } } @@ -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);