about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2016-09-30 13:44:46 -0400
committerGitHub <noreply@github.com>2016-09-30 13:44:46 -0400
commitcabfa9919951ac31fcec2d3f6291438ff8c40cd0 (patch)
tree61233e035514494b8ebd446a89ebf5ffd7618fb5 /src
parent71a4bde9e97dbb142606b906a6707da14ed328e8 (diff)
parent323701e3458fc6a509e518098a163db72dfc1faf (diff)
downloadrust-cabfa9919951ac31fcec2d3f6291438ff8c40cd0.tar.gz
rust-cabfa9919951ac31fcec2d3f6291438ff8c40cd0.zip
Rollup merge of #36623 - GuillaumeGomez:doc_typos, r=steveklabnik
Fix some typos and improve doc comments style

r? @steveklabnik
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/slice.rs48
-rw-r--r--src/libcollections/str.rs4
-rw-r--r--src/libcollections/string.rs6
-rw-r--r--src/libcollections/vec.rs4
4 files changed, 32 insertions, 30 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 54dc7ec06da..6b705ca039f 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -168,7 +168,7 @@ impl<T> [T] {
         core_slice::SliceExt::len(self)
     }
 
-    /// Returns true if the slice has a length of 0
+    /// Returns true if the slice has a length of 0.
     ///
     /// # Example
     ///
@@ -402,7 +402,7 @@ impl<T> [T] {
         core_slice::SliceExt::get_unchecked_mut(self, index)
     }
 
-    /// Returns an raw pointer to the slice's buffer
+    /// Returns an raw pointer to the slice's buffer.
     ///
     /// The caller must ensure that the slice outlives the pointer this
     /// function returns, or else it will end up pointing to garbage.
@@ -468,7 +468,7 @@ impl<T> [T] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = ["a", "b", "c", "d"];
     /// v.swap(1, 3);
     /// assert!(v == ["a", "d", "c", "b"]);
@@ -483,7 +483,7 @@ impl<T> [T] {
     ///
     /// # Example
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [1, 2, 3];
     /// v.reverse();
     /// assert!(v == [3, 2, 1]);
@@ -567,9 +567,9 @@ impl<T> [T] {
     }
 
     /// Returns an iterator over `size` elements of the slice at a
-    /// time. The chunks are slices and do not overlap. If `size` does not divide the
-    /// length of the slice, then the last chunk will not have length
-    /// `size`.
+    /// time. The chunks are slices and do not overlap. If `size` does
+    /// not divide the length of the slice, then the last chunk will
+    /// not have length `size`.
     ///
     /// # Panics
     ///
@@ -656,7 +656,7 @@ impl<T> [T] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [1, 2, 3, 4, 5, 6];
     ///
     /// // scoped to restrict the lifetime of the borrows
@@ -754,7 +754,7 @@ impl<T> [T] {
     }
 
     /// Returns an iterator over subslices separated by elements that match
-    /// `pred`, limited to returning at most `n` items.  The matched element is
+    /// `pred`, limited to returning at most `n` items. The matched element is
     /// not contained in the subslices.
     ///
     /// The last element returned, if any, will contain the remainder of the
@@ -781,7 +781,7 @@ impl<T> [T] {
     }
 
     /// Returns an iterator over subslices separated by elements that match
-    /// `pred`, limited to returning at most `n` items.  The matched element is
+    /// `pred`, limited to returning at most `n` items. The matched element is
     /// not contained in the subslices.
     ///
     /// The last element returned, if any, will contain the remainder of the
@@ -835,7 +835,7 @@ impl<T> [T] {
 
     /// Returns an iterator over subslices separated by elements that match
     /// `pred` limited to returning at most `n` items. This starts at the end of
-    /// the slice and works backwards.  The matched element is not contained in
+    /// the slice and works backwards. The matched element is not contained in
     /// the subslices.
     ///
     /// The last element returned, if any, will contain the remainder of the
@@ -922,9 +922,9 @@ impl<T> [T] {
     ///
     /// Looks up a series of four elements. The first is found, with a
     /// uniquely determined position; the second and third are not
-    /// found; the fourth could match any position in `[1,4]`.
+    /// found; the fourth could match any position in `[1, 4]`.
     ///
-    /// ```rust
+    /// ```
     /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     ///
     /// assert_eq!(s.binary_search(&13),  Ok(9));
@@ -956,9 +956,9 @@ impl<T> [T] {
     ///
     /// Looks up a series of four elements. The first is found, with a
     /// uniquely determined position; the second and third are not
-    /// found; the fourth could match any position in `[1,4]`.
+    /// found; the fourth could match any position in `[1, 4]`.
     ///
-    /// ```rust
+    /// ```
     /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     ///
     /// let seek = 13;
@@ -982,21 +982,23 @@ impl<T> [T] {
     /// Binary search a sorted slice with a key extraction function.
     ///
     /// Assumes that the slice is sorted by the key, for instance with
-    /// `sort_by_key` using the same key extraction function.
+    /// [`sort_by_key`] using the same key extraction function.
     ///
     /// If a matching value is found then returns `Ok`, containing the
     /// index for the matched element; if no match is found then `Err`
     /// is returned, containing the index where a matching element could
     /// be inserted while maintaining sorted order.
     ///
+    /// [`sort_by_key`]: #method.sort_by_key
+    ///
     /// # Examples
     ///
     /// Looks up a series of four elements in a slice of pairs sorted by
     /// their second elements. The first is found, with a uniquely
     /// determined position; the second and third are not found; the
-    /// fourth could match any position in `[1,4]`.
+    /// fourth could match any position in `[1, 4]`.
     ///
-    /// ```rust
+    /// ```
     /// let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
     ///          (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
     ///          (1, 21), (2, 34), (4, 55)];
@@ -1023,7 +1025,7 @@ impl<T> [T] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [-5, 4, 1, -3, 2];
     ///
     /// v.sort();
@@ -1045,7 +1047,7 @@ impl<T> [T] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [-5i32, 4, 1, -3, 2];
     ///
     /// v.sort_by_key(|k| k.abs());
@@ -1067,7 +1069,7 @@ impl<T> [T] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [5, 4, 1, 3, 2];
     /// v.sort_by(|a, b| a.cmp(b));
     /// assert!(v == [1, 2, 3, 4, 5]);
@@ -1094,7 +1096,7 @@ impl<T> [T] {
     ///
     /// # Example
     ///
-    /// ```rust
+    /// ```
     /// let mut dst = [0, 0, 0];
     /// let src = [1, 2, 3];
     ///
@@ -1116,7 +1118,7 @@ impl<T> [T] {
     ///
     /// # Example
     ///
-    /// ```rust
+    /// ```
     /// let mut dst = [0, 0, 0];
     /// let src = [1, 2, 3];
     ///
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 6a6b450e518..96efe1a03e3 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -697,7 +697,7 @@ impl str {
     ///
     /// Basic usage:
     ///
-    /// ```rust
+    /// ```
     /// let bananas = "bananas";
     ///
     /// assert!(bananas.ends_with("anas"));
@@ -900,7 +900,7 @@ impl str {
     ///
     /// It does _not_ give you:
     ///
-    /// ```rust,ignore
+    /// ```,ignore
     /// assert_eq!(d, &["a", "b", "c"]);
     /// ```
     ///
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index e4930ae3572..119828ea43c 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -21,7 +21,7 @@
 //!
 //! There are multiple ways to create a new `String` from a string literal:
 //!
-//! ```rust
+//! ```
 //! let s = "Hello".to_string();
 //!
 //! let s = String::from("world");
@@ -31,7 +31,7 @@
 //! You can create a new `String` from an existing one by concatenating with
 //! `+`:
 //!
-//! ```rust
+//! ```
 //! let s = "Hello".to_string();
 //!
 //! let message = s + " world!";
@@ -40,7 +40,7 @@
 //! If you have a vector of valid UTF-8 bytes, you can make a `String` out of
 //! it. You can do the reverse too.
 //!
-//! ```rust
+//! ```
 //! let sparkle_heart = vec![240, 159, 146, 150];
 //!
 //! // We know these bytes are valid, so we'll use `unwrap()`.
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index e868a542d55..ed6eb62c967 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1769,7 +1769,7 @@ impl<T> IntoIter<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// # #![feature(vec_into_iter_as_slice)]
     /// let vec = vec!['a', 'b', 'c'];
     /// let mut into_iter = vec.into_iter();
@@ -1788,7 +1788,7 @@ impl<T> IntoIter<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// # #![feature(vec_into_iter_as_slice)]
     /// let vec = vec!['a', 'b', 'c'];
     /// let mut into_iter = vec.into_iter();