Simplify Debug for {EnumSet, VecDeque}

This commit is contained in:
Andrew Paseltiner 2015-09-25 12:03:03 -04:00
parent 5ca60d9431
commit db18718809
2 changed files with 2 additions and 18 deletions

View File

@ -49,16 +49,7 @@ impl<E> Clone for EnumSet<E> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
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()
}
}

View File

@ -1787,14 +1787,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
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()
}
}