Skip to content

Commit

Permalink
Change Copy bound to Clone
Browse files Browse the repository at this point in the history
Elsewhere in the crate when we have a borrow but need ownership, we
clone instead of copy.  It seems it would be more consistent to do the
same here.
  • Loading branch information
clint-white committed May 1, 2022
1 parent bedc65a commit 1d49f69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,8 @@ where

impl<'a, T: 'a, N: 'a> Extend<(&'a T, &'a N)> for Counter<T, N>
where
T: Hash + Eq + Copy,
N: AddAssign + Zero + Copy,
T: Hash + Eq + Clone,
N: AddAssign + Zero + Clone,
{
/// Extend a counter with `(item, count)` tuples.
///
Expand All @@ -951,8 +951,8 @@ where
/// ```
fn extend<I: IntoIterator<Item = (&'a T, &'a N)>>(&mut self, iter: I) {
for (item, item_count) in iter.into_iter() {
let entry = self.map.entry(*item).or_insert_with(N::zero);
*entry += *item_count;
let entry = self.map.entry(item.clone()).or_insert_with(N::zero);
*entry += item_count.clone();
}
}
}
Expand Down

0 comments on commit 1d49f69

Please sign in to comment.