Skip to content

implement ExactSizeIterator for slice::{Chunks,ChunksMut,Windows} #21053

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

Merged
merged 1 commit into from
Jan 22, 2015
Merged

implement ExactSizeIterator for slice::{Chunks,ChunksMut,Windows} #21053

merged 1 commit into from
Jan 22, 2015

Conversation

apasel422
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -1212,6 +1212,9 @@ impl<'a, T> Iterator for Windows<'a, T> {
}
}

#[stable]
impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation may not forever be right as the above size_hint may sometimes return None for the upper bound (albeit somewhat rarely)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume I should remove this impl, then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, yes, let's remove it until we're guaranteed that size_hint always returns an exact size hint.

@alexcrichton
Copy link
Member

Thanks! Could you add some tests for the new implementations as well?

@alexcrichton alexcrichton assigned alexcrichton and unassigned brson Jan 20, 2015
@apasel422
Copy link
Contributor Author

Updated.

@alexcrichton
Copy link
Member

@bors: r+ 1a76263

Thanks!

@apasel422
Copy link
Contributor Author

I had to update this due to missing imports and a mutability issue in the tests.

@alexcrichton
Copy link
Member

@bors: r+ 2cc7feb

@aturon
Copy link
Member

aturon commented Jan 21, 2015

@bors: rollup

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 21, 2015
@bors bors merged commit 2cc7feb into rust-lang:master Jan 22, 2015
@apasel422 apasel422 deleted the exact branch January 22, 2015 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants