You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #321 - JustForFun88:JustForFun88-patch-1, r=Amanieu
Correct the implementation of Debug for ValuesMut and IntoValues structures
Previously the implementation of Debug trait for ValuesMut was
```
impl<K, V> fmt::Debug for ValuesMut<'_, K, V>
where
K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.inner.iter()).finish()
}
}
```
It is strange, because `self.inner.iter()` return an iterator with element of type `(&’a K, &’a V)`.
The same is true when we look at the old implementation of Debug trait for the `IntoValues` structure. Here we have mistake
```
impl<K: Debug, V: Debug, A: Allocator + Clone> fmt::Debug for IntoValues<K, V, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter().map(|(k, _)| k))
.finish()
}
}
```
because with the function `self.inner.iter().map(|(k, _)| k)` we return iterator with element of type 'a K.
0 commit comments