From fa7a40cc6ee7e16c948a804dbb487d36b3d0ccc9 Mon Sep 17 00:00:00 2001 From: Observer42 Date: Mon, 12 Aug 2019 16:07:13 +0800 Subject: [PATCH 1/2] Document From trait for BinaryHeap --- src/liballoc/collections/binary_heap.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 9f531f5b83c75..cc6c69d5738ea 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -1163,6 +1163,9 @@ impl FusedIterator for Drain<'_, T> {} #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] impl From> for BinaryHeap { + /// Converts a `Vec` into a `BinaryHeap`. + /// + /// This conversion happens in-place, and has O(n) time complexity. fn from(vec: Vec) -> BinaryHeap { let mut heap = BinaryHeap { data: vec }; heap.rebuild(); From e30480ca864c5810c89bbf1f475eb0bc2999c251 Mon Sep 17 00:00:00 2001 From: Observer42 Date: Mon, 12 Aug 2019 18:07:14 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-Authored-By: Mazdak Farrokhzad --- src/liballoc/collections/binary_heap.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index cc6c69d5738ea..3d04f30e7bde5 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -1163,9 +1163,9 @@ impl FusedIterator for Drain<'_, T> {} #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] impl From> for BinaryHeap { - /// Converts a `Vec` into a `BinaryHeap`. + /// Converts a `Vec` into a `BinaryHeap`. /// - /// This conversion happens in-place, and has O(n) time complexity. + /// This conversion happens in-place, and has `O(n)` time complexity. fn from(vec: Vec) -> BinaryHeap { let mut heap = BinaryHeap { data: vec }; heap.rebuild();