]> git.lizzy.rs Git - rust.git/commitdiff
Use sort_unstable_by in its own docs
authorKagami Sascha Rosylight <saschanaz@outlook.com>
Sun, 24 May 2020 12:56:57 +0000 (14:56 +0200)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 12:56:57 +0000 (14:56 +0200)
src/libcore/slice/mod.rs

index b5ce165cb43db352c4f945a9df5cc7ff1e9fb97d..2361749f166450b6ba6d636a720f6205ba9fcb12 100644 (file)
@@ -1654,7 +1654,7 @@ pub fn sort_unstable(&mut self)
     ///
     /// ```
     /// let mut floats = [5f64, 4.0, 1.0, 3.0, 2.0];
-    /// floats.sort_by(|a, b| a.partial_cmp(b).unwrap());
+    /// floats.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap());
     /// assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 5.0]);
     /// ```
     ///