Skip to content

Commit 74e731f

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 8b5f692 + ae3feff commit 74e731f

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,9 @@ impl DepGraph {
523523
}
524524

525525
pub fn serialize(&self) -> SerializedDepGraph {
526-
let mut fingerprints = self.fingerprints.borrow_mut();
527526
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
528527

529-
// Make sure we don't run out of bounds below.
530-
if current_dep_graph.nodes.len() > fingerprints.len() {
531-
fingerprints.resize(current_dep_graph.nodes.len(), Fingerprint::ZERO);
532-
}
533-
534-
let fingerprints = fingerprints.clone().convert_index_type();
528+
let fingerprints = self.fingerprints.borrow().clone().convert_index_type();
535529
let nodes = current_dep_graph.nodes.clone().convert_index_type();
536530

537531
let total_edge_count: usize = current_dep_graph.edges.iter()

0 commit comments

Comments
 (0)