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

range: make 'as_singleton' return a borrow #23

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Conversation

BurntSushi
Copy link
Member

It's cheaper this way if the caller only needs a &V. If the caller
needs a V, then they can clone it.

We can also move it to an impl block that only requires Ord, so that
it will work with V types that don't implement Clone.

It's cheaper this way if the caller only needs a `&V`. If the caller
needs a `V`, then they can clone it.

We can also move it to an impl block that only requires `Ord`, so that
it will work with `V` types that don't implement `Clone`.
Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Cool thanks!

@BurntSushi BurntSushi merged commit 9b6d89c into main Feb 8, 2024
5 checks passed
@BurntSushi BurntSushi deleted the ag/fix-as-singleton branch February 8, 2024 17:41
BurntSushi added a commit to astral-sh/uv that referenced this pull request Feb 14, 2024
This brings in a [PR] that makes `Range::as_singleton` return a
borrow.

[PR]: astral-sh/pubgrub#23
BurntSushi added a commit to astral-sh/uv that referenced this pull request Feb 14, 2024
This brings in a [PR] that makes `Range::as_singleton` return a
borrow.

[PR]: astral-sh/pubgrub#23
BurntSushi added a commit to astral-sh/uv that referenced this pull request Feb 15, 2024
This brings in a [PR] that makes `Range::as_singleton` return a
borrow.

[PR]: astral-sh/pubgrub#23
BurntSushi added a commit to astral-sh/uv that referenced this pull request Feb 15, 2024
This brings in a [PR] that makes `Range::as_singleton` return a
borrow.

[PR]: astral-sh/pubgrub#23
konstin pushed a commit that referenced this pull request Mar 6, 2024
It's cheaper this way if the caller only needs a `&V`. If the caller
needs a `V`, then they can clone it.

We can also move it to an impl block that only requires `Ord`, so that
it will work with `V` types that don't implement `Clone`.
konstin pushed a commit that referenced this pull request Mar 12, 2024
It's cheaper this way if the caller only needs a `&V`. If the caller
needs a `V`, then they can clone it.

We can also move it to an impl block that only requires `Ord`, so that
it will work with `V` types that don't implement `Clone`.
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