diff --git a/src/map.rs b/src/map.rs index 4f6c762..53c9353 100644 --- a/src/map.rs +++ b/src/map.rs @@ -491,15 +491,7 @@ impl GenericPatriciaMap { } impl fmt::Debug for GenericPatriciaMap { 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 Clone for GenericPatriciaMap { diff --git a/src/set.rs b/src/set.rs index 363c464..9895637 100644 --- a/src/set.rs +++ b/src/set.rs @@ -246,15 +246,7 @@ impl GenericPatriciaSet { } impl fmt::Debug for GenericPatriciaSet { 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 Clone for GenericPatriciaSet {