diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47332:4ee9f419c52e

rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs This will enable the tree-based DirstateMap to not always have an actual DirstateEntry in memory for all nodes, but construct it on demand. Differential Revision: https://phab.mercurial-scm.org/D10746
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 13:15:00 +0200
parents 0252600fd1cf
children 69530e5d4fe5
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed May 19 13:15:00 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed May 19 13:15:00 2021 +0200
@@ -627,13 +627,13 @@
         self.get(key).is_some()
     }
 
-    fn get(&self, key: &HgPath) -> Option<&DirstateEntry> {
-        self.get_node(key)?.entry.as_ref()
+    fn get(&self, key: &HgPath) -> Option<DirstateEntry> {
+        self.get_node(key)?.entry
     }
 
     fn iter(&self) -> StateMapIter<'_> {
         Box::new(self.iter_nodes().filter_map(|(path, node)| {
-            node.entry.as_ref().map(|entry| (&**path, entry))
+            node.entry.map(|entry| (&**path, entry))
         }))
     }
 }