about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2019-06-01 19:52:18 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2019-06-08 22:38:18 -0700
commit1f4a262d85e4a87ebbdded023b2422cd41ce3fef (patch)
tree383929a6a2b93c82258422793e51815da88ebcf0 /src/liballoc
parent2da4f9ad5ed80bb1488377711699c5f320ae89db (diff)
downloadrust-1f4a262d85e4a87ebbdded023b2422cd41ce3fef.tar.gz
rust-1f4a262d85e4a87ebbdded023b2422cd41ce3fef.zip
Put the docs on the methods instead of the impls
Since simulacrum suggested (on Discord) they're better there.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/collections/vec_deque.rs106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs
index d1c9de7c83c..79a36d7248d 100644
--- a/src/liballoc/collections/vec_deque.rs
+++ b/src/liballoc/collections/vec_deque.rs
@@ -2707,35 +2707,35 @@ impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
     }
 }
 
-/// Turn a `Vec<T>` into a `VecDeque<T>`.
-///
-/// This avoids reallocating where possible, but the conditions for that are
-/// strict, and subject to change, and so shouldn't be relied upon unless the
-/// `Vec<T>` came from `From<VecDeque<T>>` has hasn't been reallocated.
-///
-/// # Examples
-///
-/// ```
-/// use std::collections::VecDeque;
-///
-/// // Start with a `VecDeque<i32>`.
-/// let deque: VecDeque<_> = (1..5).collect();
-///
-/// // Turn it into a `Vec<i32>` with no allocation needed.
-/// let mut vec = Vec::from(deque);
-///
-/// // Modify it, being careful not to trigger reallocation.
-/// vec.pop();
-/// vec.push(100);
-///
-/// // Turn it back into a `VecDeque<i32>` with no allocation needed.
-/// let ptr = vec.as_ptr();
-/// let deque = VecDeque::from(vec);
-/// assert_eq!(deque, [1, 2, 3, 100]);
-/// assert_eq!(deque.as_slices().0.as_ptr(), ptr);
-/// ```
 #[stable(feature = "vecdeque_vec_conversions", since = "1.10.0")]
 impl<T> From<Vec<T>> for VecDeque<T> {
+    /// Turn a `Vec<T>` into a `VecDeque<T>`.
+    ///
+    /// This avoids reallocating where possible, but the conditions for that are
+    /// strict, and subject to change, and so shouldn't be relied upon unless the
+    /// `Vec<T>` came from `From<VecDeque<T>>` has hasn't been reallocated.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::VecDeque;
+    ///
+    /// // Start with a `VecDeque<i32>`.
+    /// let deque: VecDeque<_> = (1..5).collect();
+    ///
+    /// // Turn it into a `Vec<i32>` with no allocation needed.
+    /// let mut vec = Vec::from(deque);
+    ///
+    /// // Modify it, being careful not to trigger reallocation.
+    /// vec.pop();
+    /// vec.push(100);
+    ///
+    /// // Turn it back into a `VecDeque<i32>` with no allocation needed.
+    /// let ptr = vec.as_ptr();
+    /// let deque = VecDeque::from(vec);
+    /// assert_eq!(deque, [1, 2, 3, 100]);
+    /// assert_eq!(deque.as_slices().0.as_ptr(), ptr);
+    /// ```
     fn from(mut other: Vec<T>) -> Self {
         unsafe {
             let other_buf = other.as_mut_ptr();
@@ -2760,34 +2760,34 @@ impl<T> From<Vec<T>> for VecDeque<T> {
     }
 }
 
-/// Turn a `VecDeque<T>` into a `Vec<T>`.
-///
-/// This never needs to re-allocate, but does need to do O(n) data movement if
-/// the circular buffer doesn't happen to be at the beginning of the allocation.
-///
-/// # Examples
-///
-/// ```
-/// use std::collections::VecDeque;
-///
-/// // This one is O(1).
-/// let deque: VecDeque<_> = (1..5).collect();
-/// let ptr = deque.as_slices().0.as_ptr();
-/// let vec = Vec::from(deque);
-/// assert_eq!(vec, [1, 2, 3, 4]);
-/// assert_eq!(vec.as_ptr(), ptr);
-///
-/// // This one needs data rearranging.
-/// let mut deque: VecDeque<_> = (1..5).collect();
-/// deque.push_front(9);
-/// deque.push_front(8);
-/// let ptr = deque.as_slices().1.as_ptr();
-/// let vec = Vec::from(deque);
-/// assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
-/// assert_eq!(vec.as_ptr(), ptr);
-/// ```
 #[stable(feature = "vecdeque_vec_conversions", since = "1.10.0")]
 impl<T> From<VecDeque<T>> for Vec<T> {
+    /// Turn a `VecDeque<T>` into a `Vec<T>`.
+    ///
+    /// This never needs to re-allocate, but does need to do O(n) data movement if
+    /// the circular buffer doesn't happen to be at the beginning of the allocation.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::VecDeque;
+    ///
+    /// // This one is O(1).
+    /// let deque: VecDeque<_> = (1..5).collect();
+    /// let ptr = deque.as_slices().0.as_ptr();
+    /// let vec = Vec::from(deque);
+    /// assert_eq!(vec, [1, 2, 3, 4]);
+    /// assert_eq!(vec.as_ptr(), ptr);
+    ///
+    /// // This one needs data rearranging.
+    /// let mut deque: VecDeque<_> = (1..5).collect();
+    /// deque.push_front(9);
+    /// deque.push_front(8);
+    /// let ptr = deque.as_slices().1.as_ptr();
+    /// let vec = Vec::from(deque);
+    /// assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
+    /// assert_eq!(vec.as_ptr(), ptr);
+    /// ```
     fn from(other: VecDeque<T>) -> Self {
         unsafe {
             let buf = other.buf.ptr();