about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-06 19:11:16 +0900
committerGitHub <noreply@github.com>2021-06-06 19:11:16 +0900
commitb3bcf4af747addb6af2fd031881c604435513c9e (patch)
tree5921f119eb15ab4e78398f6b99828f02eb0aff8b
parent9a576175cc9a0aecb85d0764a4f66ee29e26e155 (diff)
parent42b9d3fb723f33d903e1ef54a3f2439153b3a552 (diff)
downloadrust-b3bcf4af747addb6af2fd031881c604435513c9e.tar.gz
rust-b3bcf4af747addb6af2fd031881c604435513c9e.zip
Rollup merge of #85436 - tamird:save-clone, r=estebank
Avoid cloning cache key

r? `@estebank`
-rw-r--r--compiler/rustc_data_structures/src/obligation_forest/mod.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs
index 3aabe94bfc6..05b1a85381f 100644
--- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs
+++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs
@@ -342,7 +342,7 @@ impl<O: ForestObligation> ObligationForest<O> {
             return Ok(());
         }
 
-        match self.active_cache.entry(cache_key.clone()) {
+        match self.active_cache.entry(cache_key) {
             Entry::Occupied(o) => {
                 let node = &mut self.nodes[*o.get()];
                 if let Some(parent_index) = parent {
@@ -366,8 +366,7 @@ impl<O: ForestObligation> ObligationForest<O> {
                     && self
                         .error_cache
                         .get(&obligation_tree_id)
-                        .map(|errors| errors.contains(&cache_key))
-                        .unwrap_or(false);
+                        .map_or(false, |errors| errors.contains(v.key()));
 
                 if already_failed {
                     Err(())