about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-21 09:08:10 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-21 09:08:10 +0530
commitc57bb106d85d52b5c24634bcc68a4637c94c2472 (patch)
tree49e19f08b7dfe706b3be3a92352552a456665aea
parent0c949d8cc352022dc1af7f1c5f6c9aef6f085422 (diff)
parentbf8c070bd5f4ebda0a0958af8b06289c1fd7e70a (diff)
downloadrust-c57bb106d85d52b5c24634bcc68a4637c94c2472.tar.gz
rust-c57bb106d85d52b5c24634bcc68a4637c94c2472.zip
Rollup merge of #33746 - dns2utf8:doc_sort_memory, r=steveklabnik
Clarify docs for sort(&mut self)

I documented the memory usage like noted in this issue:
  * Document memory usage of sort() family of functions #33419
-rw-r--r--src/libcollections/slice.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 0f77ebb3c57..6321d5924d5 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -779,11 +779,10 @@ impl<T> [T] {
         core_slice::SliceExt::binary_search_by_key(self, b, f)
     }
 
-    /// Sorts the slice, in place.
-    ///
     /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
     ///
-    /// This is a stable sort.
+    /// This sort is stable and `O(n log n)` worst-case but allocates
+    /// approximately `2 * n` where `n` is the length of `self`.
     ///
     /// # Examples
     ///
@@ -804,11 +803,9 @@ impl<T> [T] {
     /// Sorts the slice, in place, using `key` to extract a key by which to
     /// order the sort by.
     ///
-    /// This sort is `O(n log n)` worst-case and stable, but allocates
+    /// This sort is stable and `O(n log n)` worst-case but allocates
     /// approximately `2 * n`, where `n` is the length of `self`.
     ///
-    /// This is a stable sort.
-    ///
     /// # Examples
     ///
     /// ```rust
@@ -828,7 +825,7 @@ impl<T> [T] {
     /// Sorts the slice, in place, using `compare` to compare
     /// elements.
     ///
-    /// This sort is `O(n log n)` worst-case and stable, but allocates
+    /// This sort is stable and `O(n log n)` worst-case but allocates
     /// approximately `2 * n`, where `n` is the length of `self`.
     ///
     /// # Examples