Skip to content

Commit

Permalink
Merge pull request #34 from ErichDonGubler/formatter-in-debug
Browse files Browse the repository at this point in the history
feat!: use `Formatter::debug_{map,set}` instead of hand-written outer `Debug` structure
  • Loading branch information
sile authored Oct 25, 2023
2 parents ce8f731 + dd57650 commit 4e33a2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
10 changes: 1 addition & 9 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,7 @@ impl<K: Bytes, V> GenericPatriciaMap<K, V> {
}
impl<K: Bytes + fmt::Debug, V: fmt::Debug> fmt::Debug for GenericPatriciaMap<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{{")?;
for (i, (k, v)) in self.iter().enumerate() {
if i != 0 {
write!(f, ", ")?;
}
write!(f, "{:?}: {:?}", k, v)?;
}
write!(f, "}}")?;
Ok(())
f.debug_map().entries(self.iter()).finish()
}
}
impl<K, V: Clone> Clone for GenericPatriciaMap<K, V> {
Expand Down
10 changes: 1 addition & 9 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,7 @@ impl<T: Bytes> GenericPatriciaSet<T> {
}
impl<T: Bytes + fmt::Debug> fmt::Debug for GenericPatriciaSet<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{{")?;
for (i, t) in self.iter().enumerate() {
if i != 0 {
write!(f, ", ")?;
}
write!(f, "{:?}", t)?;
}
write!(f, "}}")?;
Ok(())
f.debug_set().entries(self.iter()).finish()
}
}
impl<T> Clone for GenericPatriciaSet<T> {
Expand Down

0 comments on commit 4e33a2b

Please sign in to comment.