changeset 42810:cc424cc16704

rust-dirstate: remove unneeded "ref" At 7cae6bc29ff9, .to_owned() was rewritten as .to_owned().to_vec(), which is no longer needed since the filename is a single reference.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Aug 2019 11:43:05 +0900
parents 98901eb12245
children 8d2d5dfa07f5
files rust/hg-core/src/dirstate/parsers.rs
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/parsers.rs	Sat Aug 17 12:17:46 2019 +0900
+++ b/rust/hg-core/src/dirstate/parsers.rs	Sat Aug 17 11:43:05 2019 +0900
@@ -92,7 +92,7 @@
         .iter()
         .map(|(filename, _)| {
             let mut length = MIN_ENTRY_SIZE + filename.len();
-            if let Some(ref copy) = copy_map.get(filename) {
+            if let Some(copy) = copy_map.get(filename) {
                 length += copy.len() + 1;
             }
             length
@@ -106,8 +106,8 @@
     packed.extend(&parents.p1);
     packed.extend(&parents.p2);
 
-    for (ref filename, entry) in state_map.iter() {
-        let mut new_filename: Vec<u8> = filename.to_vec();
+    for (filename, entry) in state_map.iter() {
+        let mut new_filename: Vec<u8> = filename.to_owned();
         let mut new_mtime: i32 = entry.mtime;
         if entry.state == EntryState::Normal && entry.mtime == now {
             // The file was last modified "simultaneously" with the current
@@ -121,7 +121,7 @@
             // mistakenly treating such files as clean.
             new_mtime = -1;
             new_state_map.push((
-                filename.to_owned().to_vec(),
+                filename.to_owned(),
                 DirstateEntry {
                     mtime: new_mtime,
                     ..*entry
@@ -129,7 +129,7 @@
             ));
         }
 
-        if let Some(copy) = copy_map.get(*filename) {
+        if let Some(copy) = copy_map.get(filename) {
             new_filename.push('\0' as u8);
             new_filename.extend(copy);
         }