about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-10 11:35:37 -0500
committerGitHub <noreply@github.com>2018-05-10 11:35:37 -0500
commit74e731fcb07de3527c84e9a30821034784aa40cd (patch)
treeb15aab98ebef5cea16693396616efcd9ff043319 /src
parent8b5f6921047edfdfb450a4997811ef10f4025a58 (diff)
parentae3feff0281b2f08f6dbb75dc2e50e338a711e5f (diff)
downloadrust-74e731fcb07de3527c84e9a30821034784aa40cd.tar.gz
rust-74e731fcb07de3527c84e9a30821034784aa40cd.zip
Rollup merge of #50598 - whitfin:unnecessary-mut-borrow, r=michaelwoerister
Remove unnecessary mutable borrow and resizing in DepGraph::serialize

I might be mistaken, but I noticed this whilst in this file for something else. It appears that this mutable borrow is unnecessary and since it's locking it should be removed. The resizing looks redundant since nothing additional is added to the fingerprints in this function, so that can also be removed.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/dep_graph/graph.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index 4efb2b61e2b..03aff641005 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -523,15 +523,9 @@ impl DepGraph {
     }
 
     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()