Push to result vector instead of allocating

Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
This commit is contained in:
Dániel Buga 2020-10-22 15:06:24 +02:00
parent 45faeb43ae
commit f0d0d87a20
2 changed files with 2 additions and 5 deletions

View File

@ -415,7 +415,7 @@ impl CStore {
let span = data.get_span(id.index, sess);
let attrs: Vec<_> = data.get_item_attrs(id.index, sess).collect();
let attrs = data.get_item_attrs(id.index, sess).collect();
let ident = data.item_ident(id.index, sess);

View File

@ -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(())
}