about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-10-30 13:12:25 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-10-30 13:19:29 +1100
commita8ce44f7d9921f4ae1e620016c22f2a0ac6d8753 (patch)
treeaa436cce143d62a5a2b9fed6d71c477bdd8faecc /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parent744eb2f9372dfe9c4de9faeac27c986fb5c5fb10 (diff)
downloadrust-a8ce44f7d9921f4ae1e620016c22f2a0ac6d8753.tar.gz
rust-a8ce44f7d9921f4ae1e620016c22f2a0ac6d8753.zip
Simplify `graphviz::Formatter`.
`Formatter` currently has a `RefCell<Option<Results>>` field. This is so
the `Results` can be temporarily taken and put into a `ResultsCursor`
that is used by `BlockFormatter`, and then put back, which is messy.

This commit changes `Formatter` to have a `RefCell<ResultsCursor>` and
`BlockFormatter` to have a `&mut ResultsCursor`, which greatly
simplifies the code at the `Formatter`/`BlockFormatter` interaction
point in `Formatter::node_label`. It also means we construct a
`ResultsCursor` once per `Formatter`, instead of once per `node_label`
call.

The commit also:
- documents the reason for the `RefCell`;
- adds a `Formatter::body` method, replacing the `Formatter::body`
  field.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions