about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-12-16 14:08:21 +0100
committerGitHub <noreply@github.com>2018-12-16 14:08:21 +0100
commitc69ed5e5e9caf83db12c99848e614a475880cfa7 (patch)
treebff3fd9439362c0268d4b4efbed5798929175bc2 /src/liballoc
parent9133798b924a4ef6b9f2d602a5f3df0c8a228f57 (diff)
parent562f33b1a57acb4ccbc741fb32687aedfc4a8398 (diff)
downloadrust-c69ed5e5e9caf83db12c99848e614a475880cfa7.tar.gz
rust-c69ed5e5e9caf83db12c99848e614a475880cfa7.zip
Rollup merge of #56672 - ccouzens:master, r=nikic
Document time of back operations of a Linked List

Popping and pushing from the end of a linked list is constant time. This
documentation is already there for popping and pushing from the front.

@bors: r+ 38fe8d2 rollup
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/collections/linked_list.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index 2ef84dbade0..ba46fafaf16 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -627,7 +627,9 @@ impl<T> LinkedList<T> {
         self.pop_front_node().map(Node::into_element)
     }
 
-    /// Appends an element to the back of a list
+    /// Appends an element to the back of a list.
+    ///
+    /// This operation should compute in O(1) time.
     ///
     /// # Examples
     ///
@@ -647,6 +649,8 @@ impl<T> LinkedList<T> {
     /// Removes the last element from a list and returns it, or `None` if
     /// it is empty.
     ///
+    /// This operation should compute in O(1) time.
+    ///
     /// # Examples
     ///
     /// ```