Skip to content

Commit

Permalink
Combine drain_filter calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Oct 31, 2021
1 parent 851f2b2 commit 39d44e7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 39d44e7

Please sign in to comment.