Skip to content

Commit

Permalink
feat: remove clone by borrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien authored and anorth committed Mar 1, 2024
1 parent 4e4bdd1 commit f55f466
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actors/market/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl State {
store: BS,
) -> Result<SetMultimap<BS, ChainEpoch, DealID>, ActorError>
where
BS: Blockstore + Clone,
BS: Blockstore,
{
DealOpsByEpoch::load(store, &self.deal_ops_by_epoch, DEAL_OPS_BY_EPOCH_CONFIG, "deal ops")
}
Expand Down
2 changes: 1 addition & 1 deletion actors/market/tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ pub fn assert_n_good_deals<BS>(
epoch: ChainEpoch,
n: isize,
) where
BS: fvm_ipld_blockstore::Blockstore + Clone,
BS: fvm_ipld_blockstore::Blockstore,
{
let mut count = 0;
dobe.for_each_in(&epoch, |id| {
Expand Down
10 changes: 5 additions & 5 deletions runtime/src/util/set_multimap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where

impl<BS, K, V> SetMultimap<BS, K, V>
where
BS: Blockstore + Clone,
BS: Blockstore,
K: MapKey,
V: MapKey,
{
Expand Down Expand Up @@ -66,7 +66,7 @@ where
pub fn put(&mut self, key: &K, value: V) -> Result<(), ActorError> {
// Load HAMT from retrieved cid or create a new empty one.
let mut inner = self.get(key)?.unwrap_or_else(|| {
Set::empty(self.outer.store().clone(), self.inner_config.clone(), "multimap inner")
Set::empty(self.outer.store(), self.inner_config.clone(), "multimap inner")
});

inner.put(&value)?;
Expand All @@ -78,7 +78,7 @@ where
/// Puts slice of values in the hash set associated with a key.
pub fn put_many(&mut self, key: &K, values: &[V]) -> Result<(), ActorError> {
let mut inner = self.get(key)?.unwrap_or_else(|| {
Set::empty(self.outer.store().clone(), self.inner_config.clone(), "multimap inner")
Set::empty(self.outer.store(), self.inner_config.clone(), "multimap inner")
});

for v in values {
Expand All @@ -91,10 +91,10 @@ where

/// Gets the set of values for a key.
#[inline]
pub fn get(&self, key: &K) -> Result<Option<Set<BS, V>>, ActorError> {
pub fn get(&self, key: &K) -> Result<Option<Set<&BS, V>>, ActorError> {
match self.outer.get(key)? {
Some(cid) => Ok(Some(Set::load(
self.outer.store().clone(),
self.outer.store(),
cid,
self.inner_config.clone(),
"multimap inner",
Expand Down

0 comments on commit f55f466

Please sign in to comment.