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

feat: unique for arrays #181

Merged
merged 5 commits into from
Sep 29, 2023
Merged

feat: unique for arrays #181

merged 5 commits into from
Sep 29, 2023

Conversation

akhercha
Copy link
Contributor

@akhercha akhercha commented Sep 28, 2023

Pull Request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue number #172

What is the new behavior?

  • Added the unique methods for SpanTraitExt & ArrayTraitExt,
  • Added the corresponding unit tests.

Does this introduce a breaking change?

  • Yes
  • No

Other information

For this little snippet:

let shortest: Span<T> = if (self.len() <= 1) || (ret.len() <= self.len()) {
    ret.span()
} else {
    self
};

Without the self.len() <= 1 member some of my tests were failing.
Tried multiple things but couldn't find any better even though I feel like there's a more optimized solution... Curious to have your inputs! 🙏

@gaetbout
Copy link
Collaborator

Maybe it is best to keep the rust name (unique) as dev might be more used to that one?

@akhercha akhercha changed the title feat: drop_duplicates for arrays feat: unique for arrays Sep 29, 2023
No longer use the shortest span for the check of the element to append.

Co-authored-by: gaetbout <[email protected]>
@0xLucqs 0xLucqs merged commit 7bc7b8a into keep-starknet-strange:main Sep 29, 2023
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants