diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 7e7e8ba2356..32cd4193d88 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -49,16 +49,7 @@ impl Clone for EnumSet { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for EnumSet { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, "{{")); - let mut first = true; - for e in self { - if !first { - try!(write!(fmt, ", ")); - } - try!(write!(fmt, "{:?}", e)); - first = false; - } - write!(fmt, "}}") + fmt.debug_set().entries(self).finish() } } diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 4ee9787c9ec..6de5f27068d 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1787,14 +1787,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for VecDeque { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, "[")); - - for (i, e) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{:?}", *e)); - } - - write!(f, "]") + f.debug_list().entries(self).finish() } }