Mercurial > hg
diff rust/hg-core/src/dirstate_tree/on_disk.rs @ 47331:0252600fd1cf
dirstate-tree: Downgrade `&mut Node` to `&Node` in status and serialization
Mutable access is not used, and upcoming changes will make it more costly
(with copy-on-write nodes that can be read from disk representation)
Differential Revision: https://phab.mercurial-scm.org/D10745
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 13:15:00 +0200 |
parents | 73f23e7610f8 |
children | 69530e5d4fe5 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs Wed May 19 13:15:00 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Wed May 19 13:15:00 2021 +0200 @@ -258,7 +258,7 @@ } fn write_nodes( - nodes: &mut dirstate_map::ChildNodes, + nodes: &dirstate_map::ChildNodes, out: &mut Vec<u8>, ) -> Result<ChildNodes, DirstateError> { // `dirstate_map::ChildNodes` is a `HashMap` with undefined iteration @@ -269,7 +269,7 @@ let mut on_disk_nodes = Vec::with_capacity(nodes.len()); for (full_path, node) in nodes { on_disk_nodes.push(Node { - children: write_nodes(&mut node.children, out)?, + children: write_nodes(&node.children, out)?, tracked_descendants_count: node.tracked_descendants_count.into(), full_path: write_slice::<u8>( full_path.full_path().as_bytes(), @@ -287,7 +287,7 @@ len: 0.into(), } }, - entry: if let Some(entry) = &mut node.entry { + entry: if let Some(entry) = &node.entry { OptEntry { state: entry.state.into(), mode: entry.mode.into(),