Skip to content

Commit f0d0d87

Browse files
bugadanilcnr
andcommitted
Push to result vector instead of allocating
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
1 parent 45faeb4 commit f0d0d87

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl CStore {
415415

416416
let span = data.get_span(id.index, sess);
417417

418-
let attrs: Vec<_> = data.get_item_attrs(id.index, sess).collect();
418+
let attrs = data.get_item_attrs(id.index, sess).collect();
419419

420420
let ident = data.item_ident(id.index, sess);
421421

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -353,16 +353,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
353353
all_bounds.filter(|p| p.def_id() == stack.obligation.predicate.def_id());
354354

355355
// Keep only those bounds which may apply, and propagate overflow if it occurs.
356-
let mut param_candidates = vec![];
357356
for bound in matching_bounds {
358357
let wc = self.evaluate_where_clause(stack, bound)?;
359358
if wc.may_apply() {
360-
param_candidates.push(ParamCandidate(bound));
359+
candidates.vec.push(ParamCandidate(bound));
361360
}
362361
}
363362

364-
candidates.vec.extend(param_candidates);
365-
366363
Ok(())
367364
}
368365

0 commit comments

Comments
 (0)