about summary refs log tree commit diff
path: root/library/alloc/src/collections
diff options
context:
space:
mode:
authorJohn Kugelman <john@kugelman.name>2021-10-11 13:57:38 -0400
committerJohn Kugelman <john@kugelman.name>2021-10-11 13:57:38 -0400
commit06e625f7d582601f5e2ff69ba80f6d3a11632b24 (patch)
treed2b9b88fb89cf0f074feeaa191cb9e22a4a9eee5 /library/alloc/src/collections
parent86d6d2b7389fe1b339402c1798edae8b695fc9ef (diff)
downloadrust-06e625f7d582601f5e2ff69ba80f6d3a11632b24.tar.gz
rust-06e625f7d582601f5e2ff69ba80f6d3a11632b24.zip
Add #[must_use] to as_type conversions
Diffstat (limited to 'library/alloc/src/collections')
-rw-r--r--library/alloc/src/collections/binary_heap.rs1
-rw-r--r--library/alloc/src/collections/linked_list.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs
index 75720a970a3..9bc9c6ef162 100644
--- a/library/alloc/src/collections/binary_heap.rs
+++ b/library/alloc/src/collections/binary_heap.rs
@@ -1007,6 +1007,7 @@ impl<T> BinaryHeap<T> {
     ///
     /// io::sink().write(heap.as_slice()).unwrap();
     /// ```
+    #[must_use]
     #[unstable(feature = "binary_heap_as_slice", issue = "83659")]
     pub fn as_slice(&self) -> &[T] {
         self.data.as_slice()
diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs
index a769c558b4f..82e866c9504 100644
--- a/library/alloc/src/collections/linked_list.rs
+++ b/library/alloc/src/collections/linked_list.rs
@@ -1384,6 +1384,7 @@ impl<'a, T> CursorMut<'a, T> {
     /// The lifetime of the returned `Cursor` is bound to that of the
     /// `CursorMut`, which means it cannot outlive the `CursorMut` and that the
     /// `CursorMut` is frozen for the lifetime of the `Cursor`.
+    #[must_use]
     #[unstable(feature = "linked_list_cursors", issue = "58533")]
     pub fn as_cursor(&self) -> Cursor<'_, T> {
         Cursor { list: self.list, current: self.current, index: self.index }