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

Fix tuple_windows as lazy #602

Merged
merged 4 commits into from Oct 6, 2023

Conversation

aobatact
Copy link
Contributor

@aobatact aobatact commented Feb 7, 2022

Fix #601 anyway because this change will reduce one clone.

Copy link
Member

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

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

I've rebased and rustfmt'd this PR, but it's still failing a test. Can you fix the bug?

@Philippe-Cholet
Copy link
Member

Philippe-Cholet commented Oct 4, 2023

I deleted my previous comment, it was wrong (I must have been sleeping ^^). We would definitely need to update size_hint but there is no issue about ExactSizeIterator (the resulting iterator being shorter than the inner one, not longer 😪). Probably

use crate::size_hint::{self, SizeHint};

// then
    fn size_hint(&self) -> SizeHint {
        size_hint::sub_scalar(self.iter.size_hint(), T::num_items() - 1)
    }

EDIT: I was partially wrong, but real fix committed.

@Philippe-Cholet
Copy link
Member

@jswrenn This is ready for me, what do you think?

@jswrenn jswrenn added this pull request to the merge queue Oct 6, 2023
Merged via the queue into rust-itertools:master with commit 8db450f Oct 6, 2023
8 checks passed
@Philippe-Cholet Philippe-Cholet added this to the next milestone Nov 3, 2023
@jswrenn jswrenn mentioned this pull request Nov 14, 2023
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.

Laziness in tuple_windows
3 participants