Patchwork D10069: copies-rust: pass `PathToken` around by value

login
register
mail settings
Submitter phabricator
Date Feb. 25, 2021, 10:42 a.m.
Message ID <differential-rev-PHID-DREV-tn6oaymndzdal3j6hikn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48384/
State Superseded
Headers show

Comments

phabricator - Feb. 25, 2021, 10:42 a.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It’s just a `usize`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10069

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -617,7 +617,7 @@ 
 ) -> InternalPathCopies {
     use crate::utils::{ordmap_union_with_merge, MergeResult};
 
-    ordmap_union_with_merge(minor, major, |dest, src_minor, src_major| {
+    ordmap_union_with_merge(minor, major, |&dest, src_minor, src_major| {
         let (pick, overwrite) = compare_value(
             path_map,
             current_merge,
@@ -664,7 +664,7 @@ 
     path_map: &TwoWayPathMap,
     current_merge: Revision,
     changes: &ChangedFiles,
-    dest: &PathToken,
+    dest: PathToken,
     src_minor: &CopySource,
     src_major: &CopySource,
 ) -> (MergePick, bool) {
@@ -693,7 +693,7 @@ 
         }
     } else {
         debug_assert!(src_major.rev != src_major.rev);
-        let dest_path = path_map.untokenize(*dest);
+        let dest_path = path_map.untokenize(dest);
         let action = changes.get_merge_case(dest_path);
         if src_minor.path.is_some()
             && src_major.path.is_none()