Skip to content

Commit

Permalink
move primary initialization logic from init to from_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
coriolinus committed Sep 18, 2023
1 parent ba3fbdb commit 14cd714
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/impls/from_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ where
where
I: IntoIterator<Item = T>,
{
let mut counter = Counter::new();
counter.update(iterable);
counter
Self::from_iter(iterable)
}
}

Expand All @@ -42,8 +40,10 @@ where
/// assert_eq!(counter.into_map(), expect);
/// ```
///
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
Counter::<T, N>::init(iter)
fn from_iter<I: IntoIterator<Item = T>>(iterable: I) -> Self {
let mut counter = Counter::new();
counter.update(iterable);
counter
}
}

Expand Down

0 comments on commit 14cd714

Please sign in to comment.