From f0d0d87a2002dea7365ce2230e2df2ed4786fcbe Mon Sep 17 00:00:00 2001 From: Dániel Buga Date: Thu, 22 Oct 2020 15:06:24 +0200 Subject: Push to result vector instead of allocating Co-authored-by: lcnr --- .../rustc_trait_selection/src/traits/select/candidate_assembly.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index b0bfb4ad173..ea18a689065 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -353,16 +353,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { all_bounds.filter(|p| p.def_id() == stack.obligation.predicate.def_id()); // Keep only those bounds which may apply, and propagate overflow if it occurs. - let mut param_candidates = vec![]; for bound in matching_bounds { let wc = self.evaluate_where_clause(stack, bound)?; if wc.may_apply() { - param_candidates.push(ParamCandidate(bound)); + candidates.vec.push(ParamCandidate(bound)); } } - candidates.vec.extend(param_candidates); - Ok(()) } -- cgit 1.4.1-3-g733a5