From bca28640842f02614272d284cc54f8debcfde91d Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Thu, 20 Feb 2025 15:54:25 +0100 Subject: [PATCH] Move `Deref{Mut}` from common module to `owned` We have several trait implementations for `Script` and `ScriptBuf` in a common module so that it's easy to verify that they are same but `Deref` and `DerefMut` should *not* be implemented for `Script` so having them in the common module is not helpful. This moves them to the appropriate `Owned` module. --- primitives/src/script/mod.rs | 11 ----------- primitives/src/script/owned.rs | 13 +++++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/primitives/src/script/mod.rs b/primitives/src/script/mod.rs index d628de796..7ea5b928a 100644 --- a/primitives/src/script/mod.rs +++ b/primitives/src/script/mod.rs @@ -10,7 +10,6 @@ mod owned; use core::cmp::Ordering; use core::convert::Infallible; use core::fmt; -use core::ops::{Deref, DerefMut}; use hashes::{hash160, sha256}; use hex::DisplayHex; @@ -415,16 +414,6 @@ impl fmt::UpperHex for ScriptBuf { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::UpperHex::fmt(self.as_script(), f) } } -impl Deref for ScriptBuf { - type Target = Script; - - fn deref(&self) -> &Self::Target { self.as_script() } -} - -impl DerefMut for ScriptBuf { - fn deref_mut(&mut self) -> &mut Self::Target { self.as_mut_script() } -} - impl Borrow