-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-sliceArea: `[T]`Area: `[T]`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
When sorting primitive types, without a sort_by function, sort and sort_unstable produce the same output (because the "identical elements" are themselves indistinguishable).
This change was done by hand ( #76541 ), and clippy will recommend changing sort to sort_unstable on primitive types.
However, if it is so useful it feels like it should be easy to do within the standard library itself, if there is a trait (or a trait was added) for primitive types.
This feel preferably to the current situation, where clippy tells users to change it, as then (see #76541 for example ), users have to keep adding comments to remind themselves that the sort_unstable is actually stable in this case.
Metadata
Metadata
Assignees
Labels
A-sliceArea: `[T]`Area: `[T]`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.