# HG changeset patch # User Yuya Nishihara # Date 1566009785 -32400 # Node ID cc424cc1670489e89c3fd3cc5e48db6661491eec # Parent 98901eb12245cba1bab6d300c5f7d0dc32f8080e 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. diff -r 98901eb12245 -r cc424cc16704 rust/hg-core/src/dirstate/parsers.rs --- 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 = filename.to_vec(); + for (filename, entry) in state_map.iter() { + let mut new_filename: Vec = 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); }