From 06dff5e61585e823dc4f25d09d070a34402c58df Mon Sep 17 00:00:00 2001 From: Andrei Silviu Dragnea Date: Sat, 4 Nov 2023 14:52:16 +0200 Subject: [PATCH] NDEV-2329: impl Clone for Inner --- evm_loader/program/src/evm/buffer.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/evm_loader/program/src/evm/buffer.rs b/evm_loader/program/src/evm/buffer.rs index 074fa99b17..286db715b5 100644 --- a/evm_loader/program/src/evm/buffer.rs +++ b/evm_loader/program/src/evm/buffer.rs @@ -164,18 +164,25 @@ impl Deref for Buffer { impl Clone for Buffer { #[inline] fn clone(&self) -> Self { - match &self.inner { - Inner::Empty => Self::empty(), - Inner::Owned(allocation) => Self::new(Inner::Owned(allocation.clone())), - Inner::Account { key, data, range } => Self::new(Inner::Account { + Self::new(self.inner.clone()) + } +} + +impl Clone for Inner { + #[inline] + fn clone(&self) -> Self { + match &self { + Inner::Empty => Inner::Empty, + Inner::Owned(allocation) => Inner::Owned(allocation.clone()), + Inner::Account { key, data, range } => Inner::Account { key: *key, data: *data, range: range.clone(), - }), - Inner::AccountUninit { key, range } => Self::new(Inner::AccountUninit { + }, + Inner::AccountUninit { key, range } => Inner::AccountUninit { key: *key, range: range.clone(), - }), + }, } } }