Skip to content

Commit

Permalink
Clean up debug impls
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Mar 30, 2015
1 parent 7f0392a commit 7e32f39
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
6 changes: 1 addition & 5 deletions phf/src/map.rs
Expand Up @@ -26,11 +26,7 @@ pub struct Map<K:'static, V:'static> {

impl<K, V> fmt::Debug for Map<K, V> where K: fmt::Debug, V: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let mut builder = fmt.debug_map();
for (k, v) in self {
builder = builder.entry(k, v);
}
builder.finish()
self.entries().fold(fmt.debug_map(), |b, (k, v)| b.entry(k, v)).finish()
}
}

Expand Down
6 changes: 1 addition & 5 deletions phf/src/ordered_map.rs
Expand Up @@ -32,11 +32,7 @@ pub struct OrderedMap<K:'static, V:'static> {

impl<K, V> fmt::Debug for OrderedMap<K, V> where K: fmt::Debug, V: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let mut builder = fmt.debug_map();
for (k, v) in self {
builder = builder.entry(k, v);
}
builder.finish()
self.entries().fold(fmt.debug_map(), |b, (k, v)| b.entry(k, v)).finish()
}
}

Expand Down
6 changes: 1 addition & 5 deletions phf/src/ordered_set.rs
Expand Up @@ -23,11 +23,7 @@ pub struct OrderedSet<T:'static> {

impl<T> fmt::Debug for OrderedSet<T> where T: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let mut builder = fmt.debug_set();
for entry in self {
builder = builder.entry(entry);
}
builder.finish()
self.iter().fold(fmt.debug_set(), |b, e| b.entry(e)).finish()
}
}

Expand Down
6 changes: 1 addition & 5 deletions phf/src/set.rs
Expand Up @@ -22,11 +22,7 @@ pub struct Set<T:'static> {

impl<T> fmt::Debug for Set<T> where T: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let mut builder = fmt.debug_set();
for entry in self {
builder = builder.entry(entry);
}
builder.finish()
self.iter().fold(fmt.debug_set(), |b, e| b.entry(e)).finish()
}
}

Expand Down

0 comments on commit 7e32f39

Please sign in to comment.