Skip to content

Commit bf8c070

Browse files
committed
Clarify docs for sort(&mut self)
1 parent d27bdaf commit bf8c070

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/libcollections/slice.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,10 @@ impl<T> [T] {
779779
core_slice::SliceExt::binary_search_by_key(self, b, f)
780780
}
781781

782-
/// Sorts the slice, in place.
783-
///
784782
/// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
785783
///
786-
/// This is a stable sort.
784+
/// This sort is stable and `O(n log n)` worst-case but allocates
785+
/// approximately `2 * n` where `n` is the length of `self`.
787786
///
788787
/// # Examples
789788
///
@@ -804,11 +803,9 @@ impl<T> [T] {
804803
/// Sorts the slice, in place, using `key` to extract a key by which to
805804
/// order the sort by.
806805
///
807-
/// This sort is `O(n log n)` worst-case and stable, but allocates
806+
/// This sort is stable and `O(n log n)` worst-case but allocates
808807
/// approximately `2 * n`, where `n` is the length of `self`.
809808
///
810-
/// This is a stable sort.
811-
///
812809
/// # Examples
813810
///
814811
/// ```rust
@@ -828,7 +825,7 @@ impl<T> [T] {
828825
/// Sorts the slice, in place, using `compare` to compare
829826
/// elements.
830827
///
831-
/// This sort is `O(n log n)` worst-case and stable, but allocates
828+
/// This sort is stable and `O(n log n)` worst-case but allocates
832829
/// approximately `2 * n`, where `n` is the length of `self`.
833830
///
834831
/// # Examples

0 commit comments

Comments
 (0)