Auto merge of #28156 - nagisa:binaryheap-debug, r=Gankro

r? @Gankro
This commit is contained in:
bors 2015-09-02 06:37:32 +00:00
commit 0dbbab9049

View File

@ -154,6 +154,7 @@
use core::iter::{FromIterator};
use core::mem::swap;
use core::ptr;
use core::fmt;
use slice;
use vec::{self, Vec};
@ -178,6 +179,13 @@ impl<T: Ord> Default for BinaryHeap<T> {
fn default() -> BinaryHeap<T> { BinaryHeap::new() }
}
#[stable(feature = "binaryheap_debug", since = "1.4.0")]
impl<T: fmt::Debug + Ord> fmt::Debug for BinaryHeap<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list().entries(self.iter()).finish()
}
}
impl<T: Ord> BinaryHeap<T> {
/// Creates an empty `BinaryHeap` as a max-heap.
///