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

Add support for dedup, dedup_by, and dedup_by_key #72

Merged
merged 2 commits into from
Nov 29, 2017
Merged

Add support for dedup, dedup_by, and dedup_by_key #72

merged 2 commits into from
Nov 29, 2017

Conversation

irrio
Copy link

@irrio irrio commented Nov 29, 2017

This change is Reviewable

@irrio
Copy link
Author

irrio commented Nov 29, 2017

This pull request adds support for dedup, dedup_by, and dedup_by_key as requested in #2

@jdm jdm mentioned this pull request Nov 29, 2017
Copy link
Collaborator

@mbrubeck mbrubeck left a comment

Choose a reason for hiding this comment

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

This looks good, thanks! One comment below:

lib.rs Outdated
@@ -91,13 +91,37 @@ pub trait VecLike<T>:

/// Append an element to the vector.
fn push(&mut self, value: T);
/// Removes consecutive repeated elements.
fn dedup(&mut self) where T: PartialEq<T>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure we want to add these as trait methods. Currently this trait is very minimal; adding these methods would be a breaking change and a bit of a burden for other types that implement it. (The use case for this trait is questionable anyway, and I think we might deprecate and remove it instead.)

If we did add these methods, then we should probably also add truncate, and then provide default implementations of the dedup methods based on that.

Copy link
Author

Choose a reason for hiding this comment

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

I have added a commit to remove these methods from the VecLike trait.

@mbrubeck
Copy link
Collaborator

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

📌 Commit 7ee6c59 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

⌛ Testing commit 7ee6c59 with merge 8f3198c...

bors-servo pushed a commit that referenced this pull request Nov 29, 2017
Add support for dedup, dedup_by, and dedup_by_key

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/72)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: mbrubeck
Pushing 8f3198c to master...

@bors-servo bors-servo merged commit 7ee6c59 into servo:master Nov 29, 2017
@mbrubeck mbrubeck mentioned this pull request Nov 30, 2017
bors-servo pushed a commit that referenced this pull request Dec 1, 2017
Version 0.6.0

Includes these changes since the last release:

* Breaking change: Remove deprecated `SmallVecN` type aliases and `push_all_move` method (#77)
* Breaking change: Make `retain` pass `&mut T` to its predicate (#61)
* Add new methods `dedup`, `dedup_by`, and `dedup_by_key` (#72)
* Deprecate the `VecLike` trait in favor of standard library traits (#74)
* Optimize the `Clone` and `Deserialize` implementations to avoid unnecessary reallocation (#71)
* Optimize `extend_from_slice` and `insert_from_slice` to use `copy_nonoverlapping` (#76)
* Include the text of the Mozilla Public License in the source repo (#69)
* Improved documentation (#75)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/78)
<!-- Reviewable:end -->
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.

3 participants