about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-10-31 16:14:16 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-10-31 16:14:16 -0500
commit39d44e72ca2ef82ea294f64e7ef3db23b4fdfd04 (patch)
tree484c2c3f2b2ef1c16485dbb6f66d5598b88aa168
parent851f2b2f969131442fc6290580d7c3632a3a24ae (diff)
downloadrust-39d44e72ca2ef82ea294f64e7ef3db23b4fdfd04.tar.gz
rust-39d44e72ca2ef82ea294f64e7ef3db23b4fdfd04.zip
Combine drain_filter calls
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 8c26ff52977..bf274dad4f0 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -946,13 +946,13 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
             };
 
             let mut deduped: SsoHashSet<_> = Default::default();
-            result
-                .obligations
-                .drain_filter(|sub_obligation| !deduped.insert(sub_obligation.clone()));
-
             let mut canonical =
                 SelectionContext::with_query_mode(selcx.infcx(), TraitQueryMode::Canonical);
+
             result.obligations.drain_filter(|projected_obligation| {
+                if !deduped.insert(projected_obligation.clone()) {
+                    return true;
+                }
                 // If any global obligations always apply, considering regions, then we don't
                 // need to include them. The `is_global` check rules out inference variables,
                 // so there's no need for the caller of `opt_normalize_projection_type`