std: Fix all code examples
This commit is contained in:
parent
6c9c045064
commit
9f1739a8e1
23 changed files with 147 additions and 90 deletions
|
@ -2174,12 +2174,12 @@ pub trait MutableVector<'a, T> {
|
|||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// let mut v = [5, 4, 1, 3, 2];
|
||||
/// v.sort(|a, b| a.cmp(b));
|
||||
/// let mut v = [5i, 4, 1, 3, 2];
|
||||
/// v.sort_by(|a, b| a.cmp(b));
|
||||
/// assert_eq!(v, [1, 2, 3, 4, 5]);
|
||||
///
|
||||
/// // reverse sorting
|
||||
/// v.sort(|a, b| b.cmp(a));
|
||||
/// v.sort_by(|a, b| b.cmp(a));
|
||||
/// assert_eq!(v, [5, 4, 3, 2, 1]);
|
||||
/// ```
|
||||
fn sort_by(self, compare: |&T, &T| -> Ordering);
|
||||
|
@ -2395,8 +2395,6 @@ pub trait MutableTotalOrdVector<T> {
|
|||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::vec;
|
||||
///
|
||||
/// let mut v = [-5, 4, 1, -3, 2];
|
||||
///
|
||||
/// v.sort();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue