]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary mutable borrow and resizing
authorIsaac Whitfield <iw@whitfin.io>
Thu, 10 May 2018 06:36:57 +0000 (23:36 -0700)
committerIsaac Whitfield <iw@whitfin.io>
Thu, 10 May 2018 06:36:57 +0000 (23:36 -0700)
src/librustc/dep_graph/graph.rs

index 22ab1b15c8b8ed225c7a4016a96f335bf80c2dab..b26281ad7ebf255b3c732475450636fb3fd60103 100644 (file)
@@ -534,15 +534,9 @@ pub fn edge_deduplication_data(&self) -> (u64, u64) {
     }
 
     pub fn serialize(&self) -> SerializedDepGraph {
-        let mut fingerprints = self.fingerprints.borrow_mut();
         let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
 
-        // Make sure we don't run out of bounds below.
-        if current_dep_graph.nodes.len() > fingerprints.len() {
-            fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::ZERO);
-        }
-
-        let fingerprints = fingerprints.clone().convert_index_type();
+        let fingerprints = self.fingerprints.borrow().clone().convert_index_type();
         let nodes = current_dep_graph.nodes.clone().convert_index_type();
 
         let total_edge_count: usize = current_dep_graph.edges.iter()