diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-09-25 11:35:01 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-09-30 05:23:07 +1000 |
| commit | 6fb1f37888f2e306344adaab0adc5f0f4a454de0 (patch) | |
| tree | 17178a244ec3bdd1cae0523c658d902980755c77 | |
| parent | 22943ee27c28efe76054a49ce20f0ab808b0599f (diff) | |
| download | rust-6fb1f37888f2e306344adaab0adc5f0f4a454de0.tar.gz rust-6fb1f37888f2e306344adaab0adc5f0f4a454de0.zip | |
Introduce some intermediate variables that aid readability.
| -rw-r--r-- | src/librustc_data_structures/obligation_forest/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 766e1d3fae3..5b99e2ae140 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -300,9 +300,10 @@ impl<O: ForestObligation> ObligationForest<O> { match self.active_cache.entry(obligation.as_predicate().clone()) { Entry::Occupied(o) => { + let index = *o.get(); debug!("register_obligation_at({:?}, {:?}) - duplicate of {:?}!", - obligation, parent, o.get()); - let node = &mut self.nodes[*o.get()]; + obligation, parent, index); + let node = &mut self.nodes[index]; if let Some(parent_index) = parent { // If the node is already in `active_cache`, it has already // had its chance to be marked with a parent. So if it's @@ -337,7 +338,8 @@ impl<O: ForestObligation> ObligationForest<O> { if already_failed { Err(()) } else { - v.insert(self.nodes.len()); + let new_index = self.nodes.len(); + v.insert(new_index); self.nodes.push(Node::new(parent, obligation, obligation_tree_id)); Ok(()) } |
