]> git.lizzy.rs Git - rust.git/commitdiff
Rewrite the first sentence in slice::sort
authorStjepan Glavina <stjepang@gmail.com>
Thu, 26 Jan 2017 10:09:45 +0000 (11:09 +0100)
committerStjepan Glavina <stjepang@gmail.com>
Thu, 26 Jan 2017 10:09:45 +0000 (11:09 +0100)
For every method, the first sentence should consisely explain what it does,
not how. This sentence usually starts with a verb.

It's really weird for `sort` to be explained in terms of another function,
namely `sort_by`. There's no need for that because it's obvious how `sort`
sorts elements: there is `T: Ord`.

If `sort_by_key` does not have to explicitly state how it's implemented,
then `sort` doesn't either.

src/libcollections/slice.rs

index fc49c9f56438ca412da444c9ae5f287717694abb..11f513ed798e07edbb7509eddf14f96cab145d6d 100644 (file)
@@ -509,7 +509,7 @@ pub fn swap(&mut self, a: usize, b: usize) {
         core_slice::SliceExt::swap(self, a, b)
     }
 
-    /// Reverse the order of elements in a slice, in place.
+    /// Reverses the order of elements in a slice, in place.
     ///
     /// # Example
     ///
@@ -1062,7 +1062,7 @@ pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, f: F) -> Result<usize, us
         core_slice::SliceExt::binary_search_by_key(self, b, f)
     }
 
-    /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
+    /// Sorts the slice.
     ///
     /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
     ///