Skip to content

Commit

Permalink
Simplify Debug for {EnumSet, VecDeque}
Browse files Browse the repository at this point in the history
  • Loading branch information
apasel422 committed Sep 25, 2015
1 parent 5ca60d9 commit db18718
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
11 changes: 1 addition & 10 deletions src/libcollections/enum_set.rs
Expand Up @@ -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()
}
}

Expand Down
9 changes: 1 addition & 8 deletions src/libcollections/vec_deque.rs
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit db18718

Please sign in to comment.