Stabilize slice_sort_by_cached_key#58074
Merged
bors merged 2 commits intorust-lang:masterfrom Feb 17, 2019
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was going to ask on the tracking issue (#34447), but decided to just send this and hope for an FCP here. The method was added last March by #48639.
Signature: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key
That's an identical signature to the existing
sort_by_key, so I think the questions are just naming, implementation, and the usual "do we want this?".The implementation seems to have proven its use in rustc at least, which many uses: https://github.com/rust-lang/rust/search?l=Rust&q=sort_by_cached_key
(I'm asking because it's exactly what I just needed the other day:
since caching that key is a pretty obviously good idea.)
Closes #34447