changeset 42795:8d2d5dfa07f5

rust-dirstate: remove too abstracted way of getting &[u8]
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Aug 2019 13:42:30 +0900
parents cc424cc16704
children 8f0881193946
files rust/hg-core/src/dirstate/dirstate_map.rs
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Sat Aug 17 11:43:05 2019 +0900
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Sat Aug 17 13:42:30 2019 +0900
@@ -130,8 +130,7 @@
         }
 
         if let Some(ref mut file_fold_map) = self.file_fold_map {
-            file_fold_map
-                .remove::<Vec<u8>>(filename.to_ascii_uppercase().as_ref());
+            file_fold_map.remove(&filename.to_ascii_uppercase());
         }
         self.state_map.insert(
             filename.to_owned(),
@@ -153,10 +152,7 @@
         filename: &[u8],
         old_state: EntryState,
     ) -> Result<bool, DirstateMapError> {
-        let exists = self
-            .state_map
-            .remove::<Vec<u8>>(filename.to_owned().as_ref())
-            .is_some();
+        let exists = self.state_map.remove(filename).is_some();
 
         if exists {
             if old_state != EntryState::Removed {
@@ -169,11 +165,9 @@
             }
         }
         if let Some(ref mut file_fold_map) = self.file_fold_map {
-            file_fold_map
-                .remove::<Vec<u8>>(filename.to_ascii_uppercase().as_ref());
+            file_fold_map.remove(&filename.to_ascii_uppercase());
         }
-        self.non_normal_set
-            .remove::<Vec<u8>>(filename.to_owned().as_ref());
+        self.non_normal_set.remove(filename);
 
         Ok(exists)
     }
@@ -251,12 +245,12 @@
 
     pub fn has_tracked_dir(&mut self, directory: &[u8]) -> bool {
         self.set_dirs();
-        self.dirs.as_ref().unwrap().contains(directory.as_ref())
+        self.dirs.as_ref().unwrap().contains(directory)
     }
 
     pub fn has_dir(&mut self, directory: &[u8]) -> bool {
         self.set_all_dirs();
-        self.all_dirs.as_ref().unwrap().contains(directory.as_ref())
+        self.all_dirs.as_ref().unwrap().contains(directory)
     }
 
     pub fn parents(