diff --git a/core/primitives/src/state.rs b/core/primitives/src/state.rs
index 8c7da64bb84..243d40e6a5f 100644
--- a/core/primitives/src/state.rs
+++ b/core/primitives/src/state.rs
@@ -4,7 +4,7 @@ use near_primitives_core::hash::{hash, CryptoHash};
use near_schema_checker_lib::ProtocolSchema;
/// State value reference. Used to charge fees for value length before retrieving the value itself.
-#[derive(BorshSerialize, BorshDeserialize, Clone, PartialEq, Eq, Hash, ProtocolSchema)]
+#[derive(BorshSerialize, BorshDeserialize, Clone, Copy, PartialEq, Eq, Hash, ProtocolSchema)]
pub struct ValueRef {
/// Value length in bytes.
pub length: u32,
@@ -91,7 +91,7 @@ impl FlatStateValue {
pub fn to_value_ref(&self) -> ValueRef {
match self {
- Self::Ref(value_ref) => value_ref.clone(),
+ Self::Ref(value_ref) => *value_ref,
Self::Inlined(value) => ValueRef::new(value),
}
}
diff --git a/core/store/src/flat/storage.rs b/core/store/src/flat/storage.rs
index 035ac11cd7c..661862e9512 100644
--- a/core/store/src/flat/storage.rs
+++ b/core/store/src/flat/storage.rs
@@ -305,7 +305,7 @@ impl FlatStorage {
let changes = guard.get_block_changes(block_hash)?;
match changes.get(key) {
Some(value_ref) => {
- return Ok(value_ref.clone().map(|value_ref| FlatStateValue::Ref(value_ref)));
+ return Ok((*value_ref).map(|value_ref| FlatStateValue::Ref(value_ref)));
}
None => {}
};
diff --git a/core/store/src/trie/insert_delete.rs b/core/store/src/trie/insert_delete.rs
index af460c0ce88..751cb04312f 100644
--- a/core/store/src/trie/insert_delete.rs
+++ b/core/store/src/trie/insert_delete.rs
@@ -9,25 +9,27 @@ use borsh::BorshSerialize;
use near_primitives::hash::{hash, CryptoHash};
use near_primitives::state::ValueRef;
-pub(crate) struct NodesStorage {
+pub(crate) struct NodesStorage<'a> {
nodes: Vec