Rollup merge of #52306 - ljedrz:obligation_forest_clone, r=varkor
Reduce the number of clone()s needed in obligation_forest Some can be avoided by using `remove_entry` instead of `remove`.
This commit is contained in:
commit
2d1880893f
|
@ -496,9 +496,14 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeState::Done => {
|
NodeState::Done => {
|
||||||
self.waiting_cache.remove(self.nodes[i].obligation.as_predicate());
|
// Avoid cloning the key (predicate) in case it exists in the waiting cache
|
||||||
// FIXME(HashMap): why can't I get my key back?
|
if let Some((predicate, _)) = self.waiting_cache
|
||||||
self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone());
|
.remove_entry(self.nodes[i].obligation.as_predicate())
|
||||||
|
{
|
||||||
|
self.done_cache.insert(predicate);
|
||||||
|
} else {
|
||||||
|
self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone());
|
||||||
|
}
|
||||||
node_rewrites[i] = nodes_len;
|
node_rewrites[i] = nodes_len;
|
||||||
dead_nodes += 1;
|
dead_nodes += 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue