-
Notifications
You must be signed in to change notification settings - Fork 310
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
Add Clone trait to Unique #777
Add Clone trait to Unique #777
Conversation
3219eac
to
a70646a
Compare
I was not gonna suggest to make a test for it but I see your point. |
Is the |
Yeah, there's no need to add an extra test here. Delete the test, run |
Thanks for both of your help! I think I've removed the test with the new CL. I added the test originally when I was trying to remove I wish this functionality didn't require Clone, but I see now that it's necessary to do the in-place iteration while removing dups. Thank you again for your time! |
Ah, wait, could you also add it to the |
Like so: #[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct Unique<I>
where
I: Iterator,
I::Item: Eq + Hash + Clone,
{
iter: UniqueBy<I, I::Item, ()>,
} |
Done! Apologies for the churn |
It's not a problem but could you squash these commits into one simple commit? EDIT: Done, thanks! |
Using a Unique iterator requires the Clone trait, so require this trait when creating the Unique object.
7f16bd6
to
328f956
Compare
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Summary: [Release Notes for 0.12.0](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0120) [Release Notes for 0.12.1](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0121) ### Breaking - Made `take_while_inclusive` consume iterator by value ([#709](rust-itertools/itertools#709)) --- there are [2 usages](https://www.internalfb.com/code/search?q=repo%3Afbcode%20take_while_inclusive&lang_filter=rust) in fbcode, verified both manually - Added `Clone` bound to `Unique` ([#777](rust-itertools/itertools#777)) --- there are [37 usages](https://fburl.com/code/hp7vdlch) in fbcode, CI will tell if it breaks Reviewed By: anps77 Differential Revision: D64305791 fbshipit-source-id: fe99131b206905133c4d2b75693090f5ce44f4ca
Using a Unique iterator requires the Clone trait, so require this trait when creating the Unique object.
See the discussion in #776