]> git.lizzy.rs Git - rust.git/commitdiff
Update wording
authorMario Carneiro <di.gama@gmail.com>
Tue, 4 Jan 2022 20:18:54 +0000 (12:18 -0800)
committerGitHub <noreply@github.com>
Tue, 4 Jan 2022 20:18:54 +0000 (12:18 -0800)
library/alloc/src/slice.rs

index 58c35dfa3611e029c083c34c36c6f61f3d9dcfd3..020dfcbaac684ab5f0f3646a0985262df66cde93 100644 (file)
@@ -371,11 +371,11 @@ pub fn sort_by_key<K, F>(&mut self, mut f: F)
 
     /// Sorts the slice with a key extraction function.
     ///
-    /// During sorting, the key function is called only once per element.
+    /// During sorting, the key function is called at most once per element, by using
+    /// temporary storage to remember the results of key evaluation.
     ///
     /// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* log(*n*))
-    /// worst-case, where the key function is *O*(*m*). If the slice requires sorting,
-    /// the key function is called on all elements of the slice in the original order.
+    /// worst-case, where the key function is *O*(*m*).
     ///
     /// For simple key functions (e.g., functions that are property accesses or
     /// basic operations), [`sort_by_key`](slice::sort_by_key) is likely to be