diff options
| author | lukaramu <lukaramu@users.noreply.github.com> | 2017-04-13 21:30:59 +0200 |
|---|---|---|
| committer | lukaramu <lukaramu@users.noreply.github.com> | 2017-04-13 22:51:05 +0200 |
| commit | d688c4d806c6272c6b7a60dbed2aa329641fbf93 (patch) | |
| tree | 5bd27ca824bc37b3a70432a9f45212311ba9cf22 /src/libcollections | |
| parent | d64de94efa8a2aeb1a104c367be1b5c03b148987 (diff) | |
| download | rust-d688c4d806c6272c6b7a60dbed2aa329641fbf93.tar.gz rust-d688c4d806c6272c6b7a60dbed2aa329641fbf93.zip | |
Various fixes throughout std::collections' docs
* Added links where possible (limited because of facading) * Changed references to methods from `foo()` to `foo` in module docs * Changed references to methods from `HashMap::foo` to just `foo` in top-level docs for `HashMap` and the `default` doc for `DefaultHasher` * Various small other fixes
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/binary_heap.rs | 7 | ||||
| -rw-r--r-- | src/libcollections/btree/set.rs | 2 | ||||
| -rw-r--r-- | src/libcollections/linked_list.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/vec_deque.rs | 13 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 0fad377c6b2..89d9576cba2 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -20,11 +20,12 @@ //! //! This is a larger example that implements [Dijkstra's algorithm][dijkstra] //! to solve the [shortest path problem][sssp] on a [directed graph][dir_graph]. -//! It shows how to use `BinaryHeap` with custom types. +//! It shows how to use [`BinaryHeap`] with custom types. //! //! [dijkstra]: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm //! [sssp]: http://en.wikipedia.org/wiki/Shortest_path_problem //! [dir_graph]: http://en.wikipedia.org/wiki/Directed_graph +//! [`BinaryHeap`]: struct.BinaryHeap.html //! //! ``` //! use std::cmp::Ordering; @@ -438,7 +439,7 @@ impl<T: Ord> BinaryHeap<T> { /// given `BinaryHeap`. Does nothing if the capacity is already sufficient. /// /// Note that the allocator may give the collection more space than it requests. Therefore - /// capacity can not be relied upon to be precisely minimal. Prefer `reserve` if future + /// capacity can not be relied upon to be precisely minimal. Prefer [`reserve`] if future /// insertions are expected. /// /// # Panics @@ -456,6 +457,8 @@ impl<T: Ord> BinaryHeap<T> { /// assert!(heap.capacity() >= 100); /// heap.push(4); /// ``` + /// + /// [`reserve`]: #method.reserve #[stable(feature = "rust1", since = "1.0.0")] pub fn reserve_exact(&mut self, additional: usize) { self.data.reserve_exact(additional); diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index 37c7581e5f4..ffca6964c5f 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -734,7 +734,7 @@ impl<T> IntoIterator for BTreeSet<T> { type Item = T; type IntoIter = IntoIter<T>; - /// Gets an iterator for moving out the BtreeSet's contents. + /// Gets an iterator for moving out the `BTreeSet`'s contents. /// /// # Examples /// diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index eabf7e47f00..bfb03a5b23f 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -636,12 +636,12 @@ impl<T> LinkedList<T> { /// Splits the list into two at the given index. Returns everything after the given index, /// including the index. /// + /// This operation should compute in O(n) time. + /// /// # Panics /// /// Panics if `at > len`. /// - /// This operation should compute in O(n) time. - /// /// # Examples /// /// ``` diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 7fe11c71d24..7b8f4f4c6c8 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -46,10 +46,15 @@ const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of /// `VecDeque` is a growable ring buffer, which can be used as a double-ended /// queue efficiently. /// -/// The "default" usage of this type as a queue is to use `push_back` to add to -/// the queue, and `pop_front` to remove from the queue. `extend` and `append` +/// The "default" usage of this type as a queue is to use [`push_back`] to add to +/// the queue, and [`pop_front`] to remove from the queue. [`extend`] and [`append`] /// push onto the back in this manner, and iterating over `VecDeque` goes front /// to back. +/// +/// [`push_back`]: #method.push_back +/// [`pop_front`]: #method.pop_front +/// [`extend`]: #method.extend +/// [`append`]: #method.append #[stable(feature = "rust1", since = "1.0.0")] pub struct VecDeque<T> { // tail and head are pointers into the buffer. Tail always points @@ -506,7 +511,7 @@ impl<T> VecDeque<T> { /// given `VecDeque`. Does nothing if the capacity is already sufficient. /// /// Note that the allocator may give the collection more space than it requests. Therefore - /// capacity can not be relied upon to be precisely minimal. Prefer `reserve` if future + /// capacity can not be relied upon to be precisely minimal. Prefer [`reserve`] if future /// insertions are expected. /// /// # Panics @@ -522,6 +527,8 @@ impl<T> VecDeque<T> { /// buf.reserve_exact(10); /// assert!(buf.capacity() >= 11); /// ``` + /// + /// [`reserve`]: #method.reserve #[stable(feature = "rust1", since = "1.0.0")] pub fn reserve_exact(&mut self, additional: usize) { self.reserve(additional); |
