about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-10-03 00:31:04 +0200
committerGitHub <noreply@github.com>2020-10-03 00:31:04 +0200
commit1118ab99301025f371f03c1345a5212c3068cf56 (patch)
tree37ad4f9a8a33347ac47a652ff3f1d11e882a2d46 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parent8876ffc9235dade728e1fbc4be4c85415fdd0bcd (diff)
parent8faf550e5f7211188bc9560ae459c155fb1aafdf (diff)
downloadrust-1118ab99301025f371f03c1345a5212c3068cf56.tar.gz
rust-1118ab99301025f371f03c1345a5212c3068cf56.zip
Rollup merge of #75377 - canova:map_debug_impl, r=dtolnay
Fix Debug implementations of some of the HashMap and BTreeMap iterator types

HashMap's `ValuesMut`, BTreeMaps `ValuesMut`, IntoValues and `IntoKeys` structs were printing both keys and values on their Debug implementations. But they are iterators over either keys or values. Irrelevant values should not be visible. With this PR, they only show relevant fields.
This fixes #75297.

[Here's an example code.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0c79356ed860e347a0c1a205616f93b7) This prints this on nightly:
```
ValuesMut { inner: IterMut { range: [(1, "hello"), (2, "goodbye")], length: 2 } }
IntoKeys { inner: [(1, "hello"), (2, "goodbye")] }
IntoValues { inner: [(1, "hello"), (2, "goodbye")] }
[(2, "goodbye"), (1, "hello")]
```

After the patch this example prints these instead:
```
["hello", "goodbye"]
["hello", "goodbye"]
[1, 2]
["hello", "goodbye"]
```

I didn't add test cases for them, since I couldn't see any tests for Debug implementations anywhere. But please let me know if I should add it to a specific place.

r? @dtolnay
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions