Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop ExactSizeIterator requirement from Index::extend #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/impls/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ where
R: Region + Push<T>,
O: IndexContainer<usize>,
I: IntoIterator<Item = T>,
I::IntoIter: ExactSizeIterator,
{
#[inline]
fn push(&mut self, item: PushIter<I>) -> <ColumnsRegion<R, O> as Region>::Index {
Expand Down
16 changes: 3 additions & 13 deletions src/impls/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
/// Accepts a newly pushed element.
fn push(&mut self, item: T);

/// Extend from iterator. Must be [`ExactSizeIterator`] to efficiently
/// pre-allocate.
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
where
I::IntoIter: ExactSizeIterator;
/// Extend from iterator.
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I);

/// Returns an iterator over the elements.
fn iter(&self) -> Self::Iter<'_>;
Expand Down Expand Up @@ -316,12 +313,10 @@
#[inline]
fn push(&mut self, item: usize) {
self.push(item)
}

Check warning on line 316 in src/impls/index.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/flatcontainer/flatcontainer/src/impls/index.rs

#[inline]
fn extend<I: IntoIterator<Item = usize>>(&mut self, iter: I)
where
I::IntoIter: ExactSizeIterator,
{
for item in iter {
self.push(item);
Expand Down Expand Up @@ -432,12 +427,10 @@
}
} else {
self.spilled.push(item);
}

Check warning on line 430 in src/impls/index.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/flatcontainer/flatcontainer/src/impls/index.rs
}

fn extend<I: IntoIterator<Item = usize>>(&mut self, iter: I)
where
I::IntoIter: ExactSizeIterator,
{
for item in iter {
self.push(item);
Expand Down Expand Up @@ -483,10 +476,7 @@
self.push(item);
}

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
where
I::IntoIter: ExactSizeIterator,
{
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
Extend::extend(self, iter);
}

Expand Down
1 change: 0 additions & 1 deletion src/impls/slice_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ where
impl<T, S, I> Push<PushIter<I>> for OwnedRegion<T, S>
where
I: IntoIterator<Item = T>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
T: Clone,
S: Storage<T>
+ PushStorage<PushIter<I>>
Expand Down
Loading