Skip to content

Commit

Permalink
Rollup merge of rust-lang#39314 - stjepang:rewrite-sort-header, r=brson
Browse files Browse the repository at this point in the history
Rewrite the first sentence in slice::sort

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.

r? @steveklabnik
  • Loading branch information
alexcrichton committed Jan 28, 2017
2 parents 06fcccf + f02c9e3 commit 4ef67ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl<T> [T] {
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
///
Expand Down Expand Up @@ -1062,7 +1062,7 @@ impl<T> [T] {
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.
///
Expand Down

0 comments on commit 4ef67ba

Please sign in to comment.